public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom Kacvinsky <tkacvins@gmail.com>
To: gcc-help <gcc-help@gcc.gnu.org>
Subject: Difference in -E output
Date: Thu, 27 Oct 2022 16:22:11 -0400	[thread overview]
Message-ID: <CAG_eJLcR7d1WRi9bwngK8njFEf8TwBnKvSTJmEUCN6ntoPNpxg@mail.gmail.com> (raw)

[-- 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

             reply	other threads:[~2022-10-27 20:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 20:22 Tom Kacvinsky [this message]
2022-10-27 22:28 ` Segher Boessenkool
2022-10-27 22:33   ` Tom Kacvinsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG_eJLcR7d1WRi9bwngK8njFEf8TwBnKvSTJmEUCN6ntoPNpxg@mail.gmail.com \
    --to=tkacvins@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).