Difference in -E output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux