NOTES revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian KornbergerC preprocessor features:
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase(1) The preprocessor is centered around the libpp.a library. This
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger library provides a tokenizing implementation of the preprocessing
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger stages of ANSI standard C. The same library is used to construct
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase a standalone prepreprocessor as well as a C compiler front end
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger that, compiled with the library, eliminates the need for a
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger separate preprocessing pass. Other C tools requiring C tokenizing
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger can use this library, providing a common interface to C language
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger(2) The #pragma interface is exploited to allow the addition of new
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger directives and #pragma's without changing the preprocessor
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase executable. Most implementation details can be specified by
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger directives in the file "ppdefault.h" that is automatically included
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger (by the standalone cpp library wrapper) as an initialization step.
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger(3) #assert, #unassert and corresponding #if predicate tests have been
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger added to relieve the conflicts introduced by predefined #define
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger macros (e.g., unix, vax, u3b, ...). This is the same feature
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger present in the extended Reiser cpp that has been included in the
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger nmake distribution. (NOTE: #assert is a failed experiment)
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger(4) The implementation is sensitive to the incompatible differences
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase between the Reiser cpp (used by AT&T and BSD compilers) and the new
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger ANSI standard C. A compatibility dialect implements Reiser
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase features, allowing for a smooth transition to the ANSI standard.
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase(5) To aid in the transition to ANSI, the preprocessor can do some
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger operations that would normally be done by the lexical analysis
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger stage of a compiler front end:
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger (a) convert new-style character constants to a form
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase recognized by all current compilers
9020cdded5ce3a804bee9cee087702113629d87fIngo Becker (b) concatenate adjacent string literals
9020cdded5ce3a804bee9cee087702113629d87fIngo Becker(6) The preprocessor can also warn about obsolete constructs used
9020cdded5ce3a804bee9cee087702113629d87fIngo Becker in the compatibility dialect and on non-standard constructs
9020cdded5ce3a804bee9cee087702113629d87fIngo Becker used in the ANSI dialect. The latter is useful in writing
5cad3e82e8c017bc189c4cecc00541ec19a2a6e2Julian Kornberger C code that is made to run through other implementations of
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase ANSI standard C.
(11) <stdarg.h> has va_copy()