This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Removing # lines from .i file changes compiler behavior


I thought those lines that look like

# 18 "/usr/include/alloca.h" 3

are just comments for use by the debugger and warning printer.

But here is a case where merely removing all those lines causes extra
warnings.

It seems malloc() has a different signature in /usr/include/stdlib.h
and /usr/include/malloc.h

So I guess c++ knows about avoiding warnings in system header files?
Hmmmmmmmmmm.

The different declarations of malloc() was actually a glibc bug, but I
believe it's been fixed in the latest glibc.

(martin@lasker) /xemacs/build/mdS+-map-docstrings/src $ rm alloc.i; make alloc.i
/hack/import/egcs-20000207/inst/linux-libc2/bin/c++ -E  -Demacs -I. -DHAVE_CONFIG_H -I/usr/local/include -I/usr/X11R6/include -o alloc.i /xemacs/ws/map-docstrings/src/alloc.c
(martin@lasker) /xemacs/build/mdS+-map-docstrings/src $ /hack/import/egcs-20000207/inst/linux-libc2/bin/c++ -c -g -funsigned-char -Wall -Wpointer-arith -Winline -Wmissing-prototypes -Wmissing-declarations -Wno-switch -Wno-sign-compare  -Demacs -I. -DHAVE_CONFIG_H -I/usr/local/include -I/usr/X11R6/include alloc.i
/xemacs/ws/map-docstrings/src/alloc.c: In function `void garbage_collect_1 ()':
/xemacs/ws/map-docstrings/src/alloc.c:3458: non-lvalue in unary `&'
/xemacs/ws/map-docstrings/src/alloc.c:3488: non-lvalue in unary `&'
(martin@lasker) /xemacs/build/mdS+-map-docstrings/src $ sed 's/^# [0-9].*//' <alloc.i > alloc.ii
(martin@lasker) /xemacs/build/mdS+-map-docstrings/src $ /hack/import/egcs-20000207/inst/linux-libc2/bin/c++ -c -g -funsigned-char -Wall -Wpointer-arith -Winline -Wmissing-prototypes -Wmissing-declarations -Wno-switch -Wno-sign-compare  -Demacs -I. -DHAVE_CONFIG_H -I/usr/local/include -I/usr/X11R6/include alloc.ii
alloc.ii:27944: declaration of `void *malloc (unsigned int)' throws different exceptions
alloc.ii:4628: than previous declaration `void *malloc (unsigned int) throw ()'
alloc.ii:27947: declaration of `void *calloc (unsigned int, unsigned int)' throws different exceptions
alloc.ii:4630: than previous declaration `void *calloc (unsigned int, unsigned int) throw ()'
alloc.ii:27951: declaration of `void *realloc (void *, unsigned int)' throws different exceptions
alloc.ii:4636: than previous declaration `void *realloc (void *, unsigned int) throw ()'
alloc.ii:27954: declaration of `void free (void *)' throws different exceptions
alloc.ii:4638: than previous declaration `void free (void *) throw ()'
alloc.ii:27957: declaration of `void cfree (void *)' throws different exceptions
alloc.ii:4642: than previous declaration `void cfree (void *) throw ()'
alloc.ii:27963: declaration of `void *valloc (unsigned int)' throws different exceptions
alloc.ii:4814: than previous declaration `void *valloc (unsigned int) throw ()'
alloc.ii: In function `void garbage_collect_1 ()':
alloc.ii:31104: non-lvalue in unary `&'
alloc.ii:31134: non-lvalue in unary `&'
(martin@lasker) /xemacs/build/mdS+-map-docstrings/src $ grep '\bmalloc\b *(' alloc.ii
extern void * malloc (size_t __size) throw ();
extern void * malloc (size_t __size);
...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]