As of r3802, the script preprocessor has been updated. The biggest change is the addition of support for the #if and #elif directives, which were the only major C preprocessor feature that were missing before. They are supported fully, so you can use any constant expression that you could use in an #if or #elif directive in a C or C++ program.
With this change and the bugfixes to existing preprocessor functionality in 3802, the OpenBOR preprocessor is actually quite close to a compliant C99 preprocessor. The only differences are:
I used my old test program from 2010 with a slightly modified version of the preprocessor to parse the standard C library headers on my Linux system, and it produces the correct output (same as mcpp) for every header I tested (stdio.h, stdlib.h, string.h, stdint.h) except math.h, which only fails because of the problem with concatenation mentioned above. That should be more than sufficient as practical testing.
With this change and the bugfixes to existing preprocessor functionality in 3802, the OpenBOR preprocessor is actually quite close to a compliant C99 preprocessor. The only differences are:
- No support for #pragma. Not that you care.
- #include paths can only be specified with quotes, not angle brackets (<>). The angle bracket syntax is being reserved for possible use in the future.
- Support for the concatenation operator in macros ("##") doesn't quite work for complex cases, though I'll be surprised if anyone needs it for OpenBOR.
I used my old test program from 2010 with a slightly modified version of the preprocessor to parse the standard C library headers on my Linux system, and it produces the correct output (same as mcpp) for every header I tested (stdio.h, stdlib.h, string.h, stdint.h) except math.h, which only fails because of the problem with concatenation mentioned above. That should be more than sufficient as practical testing.