ucpp [ options ] [ file ]
ucpp is a C preprocessor mostly compatible with ISO-C99. It
is rather strict and uses only a small amount of memory. It uses standard
input as primary input if no file argument is given.
There are several classes of options.
- Language
Options
- -C
- keep comments in the output.
- -s
- if a rogue '#' is encountered, do not emit an error and keep it in the
output.
- -l
- supress the emission of '#line' directives in the output.
- -lg
- convert the '#line' to the gcc-style equivalent.
- -CC
- disable C++-like comments (a '//' begins a comment, up to the end of the
line). Use this option to get closer to C90 behaviour.
- -a, -na
- handle assertions (defined with #assert); -a also defines the
standard assertions #machine , #cpu and #system (see
-e to get the local definition of such assertions).
- -a0
- disable assertion support.
- -V
- disable support for macros with a variable number of arguments: in C99, a
macro may be declared with ... as the last argument; inside the
replacement list, __VA_ARGS__ is replaced with the optional extra
arguments given in the call to the macro. Use this option to get closer to
C90 behaviour.
- -u
- enable UTF-8 support: with this option, the source is considered as an
ISO/10646 source, encoded in UTF-8. Characters represented as two bytes or
more are considered as alphabetic characters, like letters, and therefore
usable in identifiers. These characters hold the same syntactic value than
the corresponding Universal Character Names.
- -X
- enable -a, -u and -Y. This should make ucpp behave
closer to what is requested from a "modern" C preprocessor.
- -c90
- enable -V and -CC, and do not define
__STDC_VERSION__. This should make ucpp mimic older C90
behaviour.
- -t
- disable trigraph support; this seems to be required for some legacy
code.
- Warning
Options
- -wt
- emit a final warning when trigraphs are encountered.
- -wtt
- emit warnings for each trigraph encountered.
- -wa
- emit annoying warnings (these are usually useless).
- -w0
- supress standard warnings.
- Directory
Options
- -Idirectory
- -I directory
- add directory to the include path, before the standard include
path.
- -Jdirectory
- -J directory
- add directory to the include path, after the standard include
path.
- -zI
- do not use the standard (compile-time) include path.
- -M
- emit only the names of encountered files, separated by spaces; this is
intended for automatic generation of Makefile dependencies.
- -Ma
- do the same as -M but also for system files.
- -o file
- direct the ouput to file instead of standard output.
- Macro
Options
- -Dmacro
- predefine macro with content 1.
- -Dmacro=def
- predefine macro with the content def.
- -Umacro
- undefine macro.
- -Y
- predefine system-dependant macros.
- -Z
- do not predefine special macros such as __TIME__.
- -Afoo(bar)
- add foo(bar) to the list of assertions.
- -Bfoo(bar)
- remove foo(bar) of the list of assertions; you may also use
-Bfoo to remove all -Bfoo(xxx) from the list
of assertions.
- -d
- instead of normal output, emit '#define' directives representing all
macros defined during processing.
- -e
- instead of normal output, emit '#assert' directives representing all
assertions defined during processing.
- Miscellaneous
Options
- -v
- print version number, include path and (optionaly) defined
assertions.
- -h
- print some help.
ucpp is not itself affected by environment variables.
However, it uses library functions that might be affected, depending on the
system.
Thomas Pornin <pornin@bolet.org>
ucpp is considered stable software. However improbable it
is, please report bugs to the author (possibly with a file that exhibits the
problem) if the latest version, available from this site:
- http://pornin.nerim.net/ucpp/
has the bug.