🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6192

pedantic problem

#6192
From: Wayne Stewart
Date: Mon, 08 Jan 1996 00:00
60 lines
2049 bytes
Hi,

Hopefully, all the critical info about my problem appears in the
following script:

$ uname -a
SunOS frostfire 4.1.3_U1 2 sun4m
$ ./xgcc -B./ -v
Reading specs from ./specs
gcc version 2.7.2
$ cat foobar.c

#define __USE_FIXED_PROTOTYPES__

#include <stdio.h>

#ifdef FOOBAR
__asm__("
dummy:
        nop
");
#endif

int main() {
    printf ("Hello, World!\n");
    exit(0);
}
$ ./xgcc -B./ -c -ansi -Wall foobar.c
$ ./xgcc -B./ -c -ansi -Wall -DFOOBAR foobar.c
$ ./xgcc -B./ -c -ansi -Wall -pedantic foobar.c
foobar.c:7: unterminated string or character constant
foobar.c:10: unterminated string or character constant
$ echo $status
1
$ ./xgcc -B./ -c -ansi -Wall -pedantic -DFOOBAR foobar.c
foobar.c:7: warning: string constant runs past end of line
foobar.c:7: warning: ANSI C forbids newline in string constant
foobar.c:8: warning: ANSI C forbids newline in string constant
foobar.c:9: warning: ANSI C forbids newline in string constant
$ echo $status
0
$ 

My questions are:

1) Is this a bug?  In other words, why is cpp looking at the stuff
between #ifdef FOOBAR/#endif when FOOBAR isn't defined?

2) With -pedantic, why do I get fatal errors when FOOBAR isn't
defined, but non-fatal warnings when FOOBAR is defined?  The cpp
documentation says that -pedantic will produce additional warnings,
whereas -pedantic-errors produces fatal errors.  (These 2 'pedantic'
flags behave identically in this case, i.e. fatal errors.)

3) Is there a way to pass -pedantic (or -Wall for that matter) thru
to the compiler proper (cc1) without having cpp see it?

Thanks,
    Wayne Stewart
    wstewa@atl.com
Technical Details
Message-ID: <9601090049.AA13785@atl.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,ff96a0d5a08a28a3,start
X-Google-Attributes: gid113d02,public
From: wstewa@atl.com (Wayne Stewart)
Subject: pedantic problem
Date: 1996/01/08
Message-ID: <9601090049.AA13785@atl.com>
X-Deja-AN: 134573127
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: GNUs Not Usenet
newsgroups: gnu.gcc.bug