This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Ignore source code comments in scripts/check-installed-headers.sh
- From: Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>
- To: Tulio Magno Quites Machado Filho <tuliom at linux dot ibm dot com>, DJ Delorie <dj at redhat dot com>
- Cc: nd <nd at arm dot com>, "carlos at redhat dot com" <carlos at redhat dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Thu, 17 Jan 2019 10:06:16 +0000
- Subject: Re: [RFC] Ignore source code comments in scripts/check-installed-headers.sh
- References: <xnva2oi3l2.fsf@greed.delorie.com> <87ef9c3zua.fsf@linux.ibm.com>
On 17/01/2019 00:14, Tulio Magno Quites Machado Filho wrote:
> DJ Delorie <dj@redhat.com> writes:
>
>> I just tested this (gcc 4 and 7), and the #define didn't survive the
>> trip...
>>
>> $ cat foo.c
>> #define ulong unsigned long
>>
>> ulong x; /* don't use ulong */
>>
>> $ gcc -E -fpreprocessed foo.c
>> # 3 "foo.c"
>> ulong x;
>
> Yep. You're right.
> We're back to the regex. :-D
-Dd works for me:
$ cat foo.c
#define ulong unsigned long
ulong x; /* don't use ulong */
$ gcc -E -dD foo.c
# 1 "foo.c"
# 1 "<built-in>"
... gcc predefined macros ...
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 19 "/usr/include/stdc-predef.h" 3 4
#define _STDC_PREDEF_H 1
# 38 "/usr/include/stdc-predef.h" 3 4
#define __STDC_IEC_559__ 1
#define __STDC_IEC_559_COMPLEX__ 1
# 58 "/usr/include/stdc-predef.h" 3 4
#define __STDC_ISO_10646__ 201706L
#define __STDC_NO_THREADS__ 1
# 32 "<command-line>" 2
# 1 "foo.c"
#define ulong unsigned long
unsigned long x;