public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Difference in -E output
@ 2022-10-27 20:22 Tom Kacvinsky
  2022-10-27 22:28 ` Segher Boessenkool
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Kacvinsky @ 2022-10-27 20:22 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-27 22:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 20:22 Difference in -E output Tom Kacvinsky
2022-10-27 22:28 ` Segher Boessenkool
2022-10-27 22:33   ` Tom Kacvinsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).