Hi,
I've just encountered a problem with gnome-core and limits.h:
While building gnome-core/panel/session.c, GCC complains that INT_MAX is not
defined. Looking at the problem, it appears that GCC's action of #include_next
is wrong.
If you call GCC with:
gcc -I/usr/include -I. -I/usr/include ... -c file.c
your <...> search path contains:
/usr/include
.
/usr/include
/usr/local/include
/usr/arm-linuxelf/include
/usr/lib/gcc-lib/arm-linuxelf/2.8.1/include
/usr/include
And file.c #include's <limits.h>, then you end up with the following problem:
/usr/include/limits.h is included, which defines
_LIBC_LIMITS_H_
to protect against multiple inclusions.
/usr/include/limits.h includes various other header files from /usr/include/bits,
and then #include_next's <limits.h>
Since the current file was included from the first /usr/include entry in the
search path, it then tries ./limits.h (which does not exist), and then
/usr/include/limtis.h, which does exist. It starts pre-processing this file
and encounters #ifndef _LIBC_LIMITS_H_, which prevents any of limits.h being
included.
This means that the intended /usr/lib/gcc-lib/arm-linuxelf/2.8.1/include/limits.h
which contains the definition of INT_MAX for the architecture never gets included.
Surely GCC ought to either prevent duplications of header file paths, or remember
which ones have already been included and not re-include them on #include_next,
but carry on searching for another header file?
Anyway, the fix I applied was to simply comment out the #ifndef _LIBC_LIMITS_H_
since all the other header files are protected in a similar manner anyway,
and we're using GCC >2.0.0.
This is not the first time I've encountered this problem with various versions
of GCC, and have in the past fixed the flags passed to GCC. However, with the
way the gnome autoconf stuff works, it'll be very messy to fix it in every case
without breaking someone's environment. IMHO, it's a gcc problem, since GCC's
just being plain daft.
_____
|_____| ------------------------------------------------- ---+---+-
| | Russell King [EMAIL PROTECTED] --- ---
| | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |
unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]