164105f6563d98b832f603e28e506dbabed22cf3Michael H. WarfieldC preprocessor features:
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield(1) The preprocessor is centered around the libpp.a library. This
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield library provides a tokenizing implementation of the preprocessing
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield stages of ANSI standard C. The same library is used to construct
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield a standalone prepreprocessor as well as a C compiler front end
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield that, compiled with the library, eliminates the need for a
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield separate preprocessing pass. Other C tools requiring C tokenizing
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield can use this library, providing a common interface to C language
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield tokens.
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield(2) The #pragma interface is exploited to allow the addition of new
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield directives and #pragma's without changing the preprocessor
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield executable. Most implementation details can be specified by
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield directives in the file "ppdefault.h" that is automatically included
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield (by the standalone cpp library wrapper) as an initialization step.
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield(3) #assert, #unassert and corresponding #if predicate tests have been
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield added to relieve the conflicts introduced by predefined #define
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield macros (e.g., unix, vax, u3b, ...). This is the same feature
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield present in the extended Reiser cpp that has been included in the
96283b546081e7ff709968378fca25cb44f1ab6cStéphane Graber nmake distribution. (NOTE: #assert is a failed experiment)
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield(4) The implementation is sensitive to the incompatible differences
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield between the Reiser cpp (used by AT&T and BSD compilers) and the new
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield ANSI standard C. A compatibility dialect implements Reiser
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield features, allowing for a smooth transition to the ANSI standard.
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield(5) To aid in the transition to ANSI, the preprocessor can do some
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield operations that would normally be done by the lexical analysis
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield stage of a compiler front end:
826cde7c2100e1f4419a54b5c930c0854e01e87eMichael H. Warfield
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield (a) convert new-style character constants to a form
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield recognized by all current compilers
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield (b) concatenate adjacent string literals
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield(6) The preprocessor can also warn about obsolete constructs used
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield in the compatibility dialect and on non-standard constructs
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield used in the ANSI dialect. The latter is useful in writing
ec64264d78d4ed608553842ce9e1f07eeab2a032Veres Lajos C code that is made to run through other implementations of
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield ANSI standard C.
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield(7) The preprocessor allows a C language implementor to take
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield advantage of local extensions without invalidating the
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield conformance of the C language implementation.
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield
826cde7c2100e1f4419a54b5c930c0854e01e87eMichael H. WarfieldC9X additions:
826cde7c2100e1f4419a54b5c930c0854e01e87eMichael H. Warfield
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield(1) #pragma STDC ...
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield special forms always accecpted
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield(2) _Pragma unary operator for pragmas via macro expansion
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield _Pragma(string-literal)
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield #pragma a b c
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield _Pragma("a b c")
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield(3) keywords
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield restrict inline _Bool _Complex _Imaginary
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield(4) macros
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield __STDC_VERSION__ 199901L
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield __STDC_IEC_559__ 1 or undef
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield __STDC_IEC_559_COMPLEX__ 1 or udef
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield __STDC_ISO_10646__ yyyymmL
826cde7c2100e1f4419a54b5c930c0854e01e87eMichael H. Warfield
826cde7c2100e1f4419a54b5c930c0854e01e87eMichael H. Warfield(5) empty arguments allowed in function-like macros
826cde7c2100e1f4419a54b5c930c0854e01e87eMichael H. Warfield
826cde7c2100e1f4419a54b5c930c0854e01e87eMichael H. Warfield(6) variable arguments via ...
b4f7af7a520b23c873e404562ec518a576e63d4cMichael H. Warfield __VA_ARGS__ in replacement list only, expands to var args
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield only var args is ok (shall only appear in ...)
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield(7) hex floating constant with binary exponents
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield xxxxxx[pP]dddd
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield(8) // style comments
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield(9) universal characters, even in identifiers!
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield \uxxxx \Uxxxxxxxx
164105f6563d98b832f603e28e506dbabed22cf3Michael H. Warfield
8ec981fc8b0105da5f071e40811e0c2472a6c3c9Stéphane Graber(10) LL ll ULL ull suffix for long long literals
c63c04fcaf1c3a78c70500eae253d72fa9c8358aTAMUKI Shoichi
96283b546081e7ff709968378fca25cb44f1ab6cStéphane Graber(11) <stdarg.h> has va_copy()
96283b546081e7ff709968378fca25cb44f1ab6cStéphane Graber