This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/26052] New: cpp does not honor the -undef option
- From: "peda at lysator dot liu dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Jan 2006 22:09:13 -0000
- Subject: [Bug preprocessor/26052] New: cpp does not honor the -undef option
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I recently tried to build a package that was using cpp for other purposes than
preprocessing C files. Its configure script was looking for a way to not have
cpp predefine anything, and it specifically tried the -undef option, but
failed. From reading the docs, I couldn't figure out why. Here's a quote from
"info cpp":
'-undef'
Do not predefine any system-specific or GCC-specific macros. The
standard predefined macros remain defined. *Note Standard
Predefined Macros::.
So I searched the web a bit and figured that I could probably fix it in the
specs file. I realise that the specs file probably isn't the canonical place to
change this.
I'll attach a patch for the specs file that wraps all old define rules for cpp
inside the following:
%{!undef:old define rules}
I don't know if this is the correct thing to do, but it works for me<TM>.
"cpp -undef -mD < /dev/null" gives me this list:
#define __unix 1
#define __STDC_HOSTED__ 1
#define __unix__ 1
#define unix 1
#define __CYGWIN__ 1
#define __CYGWIN32__ 1
All but __STDC_HOSTED__ are system/gcc-specific according to "*Note Standard
Predefined Macros".
In my specific case, the configure script is looking for a way to not have
"unix" defined.
FWIW, the provided patch fixes all of the above, so that the output from the
above command is:
#define __STDC_HOSTED__ 1
Cheers,
Peter
--
Summary: cpp does not honor the -undef option
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peda at lysator dot liu dot se
GCC host triplet: i686-pc-cygwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26052