SDCPP traditional C preprocessing
C preprocessing - SDCPP
Invoked from sdcc. Takes input file, processes it and the output is internally fed to the parser "character by character" (token by token).
Although in this way the input is processed "in parallel" with the rest of the compiler, theoretically it would be possible that the preprocessor would be invoked standalone, output into a temporary file which would in turn fed into the lexer of the compiler, as the preprocessors does not share any data with the rest of the compiler.
what does it do
- expands macros/defined constants
- processes the preprocessor pragma directives and transfers all other pragmas to the parser. Preprocessor pragmas are:
- #pragma once
- GCC sspecific:
- #pragma GCC poison
- #pragma GCC system_header
- #pragma GCC dependency
- SDCC specific:
- #pragma sdcc_hash
- #pragma preproc_asm
- #pragma pedantic_parse_number
- include files?
- conditional compilation?
- remove comments?
- anything else???
- internal flow: ??? see sdcc/src/support/cpp2/
- C source file (for the particular target)
- preprocessed C source, but normally SDCPP is invoked from SDCC and the result is fed directly to the compiler (via a pipe) without being stored anywhere
- SDCPP has a lot of options - run sdcpp --help
- SDCC calls SDCPP and passes some of the options from its command line and adds other options (???)
- SDCPP is an adopted GCC preprocessor - see SDCPP history