Is C preprocessor test in configure script correct?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I was trying to bootstrap gcc for netbsd and I have found the following
problem.

In gcc/configure (around line 5585 for gcc 7.2.0) it says:
"  # Use a header file that comes with gcc, so configuring glibc
  # with a fresh cross-compiler works.
  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  # <limits.h> exists even on freestanding compilers.
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp. "Syntax error" is here to catch this case.
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
             Syntax error
_ACEOF"

This is the test that is checking if C preprocessor is working. But neither
limits.h nor assert.h were in my system includes as we have no includes in
build directory at this point. But as I read the comment the intention of
this test is to look for the header files provided with gcc itself and not
the system wide includes. Hence following CPP reference (
http://en.cppreference.com/w/cpp/preprocessor/include) when I have changed
the snippet to use # include "limits.h" and # include "assert.h" it worked
as it first looked in current dir and only then in system wide includes.

This check goes back to at least gcc 4.8.5 and I'm building the gcc with
7.2.0 on my host machine. Am I correct in this change? I would appreciate
any comments on this. And if I'm correct could this be changed in the
upstream gcc?

Cheers,
Radek



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux