TRADCPP(1)
β¨ tradcpp(1) β General Commands Manual β¨
π NAME π
tradcpp β the traditional (K&R-style) C macro preprocessor, bestie π
πΈ SYNOPSIS πΈ
tradcpp [-options] [input-file [output-file]]
π¦ DESCRIPTION π¦
Okay so the tradcpp command is literally a traditional K&R-style C macro preprocessor. It's meant to be suitable for historical Unix uses of the preprocessor, like imake(1), especially the ones that depend on whitespace being preserved π«Ά.
The chief ways traditional cpp differs from Standard C are:
- Macro arguments are expanded within quoted strings. There is no stringize operator.
- There is no token pasting operator; tokens can be concatenated by placing comments between them. This process is also not limited to valid C language tokens.
- Whitespace is preserved, and in particular tabs are not expanded into spaces. Furthermore, additional whitespace is not injected.
π OPTIONS π
tradcpp has many options, many of which are defined for compatibility with gcc(1) or other compilers. Many of the options are not yet implemented π.
π οΈ Common Options π οΈ
-Cβ Retain comments in output.-Dmacro[=expansion]β Provide a definition for the named macro. If no expansion is provided, the value1is used. Note that like many Unix compilers,tradcppdoes not accept a space between theDand the macro name.-Ipathβ Add the specified path to the main list of include directories. Note that like many Unix compilers,tradcppdoes not accept a space between theIand the directory name.-nostdincβ Do not search the standard system include directories.-Pβ Suppress line number information in the output. Currently line number information is not generated at all and this option has no effect.-Umacroβ Remove any existing definition for the named macro. Note that like many Unix compilers,tradcppdoes not accept a space between theUand the macro name.-undefβ Remove all predefined macros.
β οΈ Warning Options β οΈ
Warning options can be disabled or enabled by inserting, or not, the string no- between the W and the warning name. Herein the -Wno- form is shown for options that are enabled by default β¨.
-Wallβ Turn on all warnings. The option-Wno-alldisables only the warnings that are disabled by default.-wβ Turn off all warnings.-Werrorβ Make warnings into fatal errors.-Wcommentβ Warn about nested comments.-Wno-endif-labelsβ Don't warn about symbols attached to#endifdirectives. (The warning is currently not implemented.)-Wundefβ Warn about undefined symbols appearing in#ifand#elifexpressions.-Wunused-macrosβ Warn about macros that are defined and never used. Not implemented.
π¦ Depend Options π¦
-Mβ Generate dependency information formake(1)on the standard output, instead of preprocessing. Not implemented.-MDβ Like-Mbut skip system headers. Not implemented.-MMβ Like-Mbut write the dependency information to a file named after the input file with extension.dand preprocess normally to standard output. Not implemented.-MMDβ Like-MMbut skip system headers. Not implemented.-MF fileβ Send dependency output to the named file instead of the default location. Not implemented.-MGβ When generating dependency information, assume that missing files are generated instead of failing. Not implemented.-MPβ Issue dummy rules for all include files. This preventsmake(1)from choking if an include file is removed. Not implemented.-MQ targetβ Same as-MTexcept that anymake(1)metacharacters appearing in the target are escaped.-MT targetβ Set the name of themake(1)target appearing in the generated dependency information. The default is the name of the input file with its suffix replaced with the suffix for object files, normally.o.
π§ More Include Path Options π§
-idirafter pathβ Add the specified path to the βafterwardsβ include path. This path is searched after all directories specified with-Iand the standard system directories. Directories on this path are treated as containing system include files.-imacros fileβ Read in file prior to reading the main input file, and preprocess it, but throw away the output and retain only the macro definitions.-include fileβ Read in and preprocess file prior to reading the main input file.-iprefix prefixβ Set the path prefix used with the-iwithprefixoption.-iquote pathβ Add path to the list of directories searched for include directives written with quotes. This list is not searched for include directives written with angle brackets.-iremap string:replacementβ Substitute replacement for string in the__FILE__built-in macro. Not supported.-isysroot pathβ Use path as the βsystem rootβ, that is, the directory under which the standard system paths are found.-isystem pathβ Add path to the list of system include directories. This list is searched after the list given withI. Files found on this path are treated as system headers.-iwithprefix dirβ Splice dir onto the prefix given with-iprefixand add this directory as if it were specified with-idirafter.-iwithprefixbeforeβ Like-iwithprefixbut adds the result as if it were specified with-I.
π Diagnostic Options π
-debuglog fileβ Write a trace of actions and operations to file as the input is processed. Meant for debugging problems in complex substitution schemes fed totradcpp, such as those used byimake(1).-dDβ Dump all macro definitions, except for the predefined macros, after the normal preprocessing output. Not implemented.-dIβ Dump all include directives along with the normal preprocessing output. Not implemented.-dMβ Dump all macro definitions instead of the normal preprocessing output. Not implemented.-dNβ Like-dDbut emits only macro names and not the expansions. Not implemented.-Hβ Output a trace of the include tree as it gets processed. Not implemented.
π Other Options π
-CCβ Retain comments in output. Same as-C, accepted for compatibility withgcc(1).-fdollars-in-identifiersβ Enable the use of the dollar sign in identifiers. Not implemented.-fno-dollars-in-identifiersβ Disable the use of the dollar sign in identifiers. Not implemented.-ftabstop=numβ Set the tab width to the specified value, for reporting column positions in diagnostics. The default is8. Not implemented.-std=standardβ Asktradcppto conform to the named standard. The default, and the only supported value, iskrc.-traditionalβ This option is accepted for compatibility withgcc(1)and ignored.-x langβ Adjust the preprocessor for the given language. The only values accepted for lang areassembler-with-cppandc, neither of which have any effect on the behavior oftradcpp.
π FILES π
The default list of directories searched for include files is:
/usr/local/include
/usr/include
π SEE ALSO π
π STANDARDS π
None. The whole point of a traditional cpp is that it reflects practices in pre-standardization implementations of C. Some information is available from the first edition of Kernighan and Ritchie. Much of the rest of the behavior is based on lore, pragmatism, material encountered in the wild, and comparison to other implementations.
π°οΈ HISTORY π°οΈ
The original version of tradcpp was written one evening in late 2010. This version had some problems and was put aside. The first working version was released in June 2013 β¨.
π BUGS π
Probably plenty.
cute lil sign-off: this is the Debian source/version, dated June 11, 2013 β mwah π
π¦ where this page comes from
- nixos 26.05: tradcpp 0.5.3
- nixpkgs unstable: tradcpp 0.5.3
- Copyright (c) 2013 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms