Difference in -E output
Tom Kacvinsky
tkacvins@gmail.com
Thu Oct 27 20:22:11 GMT 2022
I am working on an issue that involves our tool depending on the
preprocessed output from gcc -E.
This simple test program exhibits the problem
#include <stdlib.h>
int main() {
return EXIT_SUCCESS;
}
With some elision, this preprocesses to:
# 3 "test.c"
int main() {
return
# 4 "test.c" 3 4
0
# 4 "test.c"
;
}
Notice how when the macro EXIT_SUCCESS is expanded, we get several lines
around the 0?
This is happening for us with GCC 8.3. But using something as early as
4.8.5 (yeah, I know,
bad idea), we get this:
int main() {
return 0;
}
I am pretty sure this is an intentional change. What I'd like to know is
if there is a way of
reverting back to the former behavior? I looked at
https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options
But didn't see anything that jumped out at me and said "this is how you can
work around it"
I did a modicum of bi-secting to see that this change was introduced
somewhere between gcc
4.9.3 and 5.4.0. I can go deeper to figure out which version actually
broke it if you would find
it helpful.
If anyone has some ideas on this, I'd appreciate hearing them.
Thanks,
Tom
More information about the Gcc-help
mailing list