This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: RFA/RFC: Using weak symbols to work around missing newlib mathfunctions in gcc.dg tests


On Thu, 2 Dec 2004, Nick Clifton wrote:
> It certainly does.  I had found that #include <stdio.h> works just fine
> as a replacement for #include <limits.h>.  My only worry about this
> (much simpler) change is that in theory any system header file could be
> subject to fixincludes processing, so relying on <stdio.h> is,
> theoretically, just as bad as relying upon <limits.h>.

There's also a fundamental difference between GCC's limits.h and
the regular fixincludes processing.  For limits.h, GCC completely
replaces/overrides the system's limits.h, completely ignoring any
other content, such as macros, prototypes, typedefs etc...  The
compiler provided  limits.h is therefore completely pristine.
Fixincludes on the other hand only modifies (or should only modify)
problematic parts of an include file.

It would be considered a bug if fixincludes ever commented out or
removed a line such as "#define _NEWLIB_VERSION", or ever excised
the "#include of <_ansi.h>" from newlib's stdio.h or sys/types.h.


Hence, you can see why relying on <limits.h> to define macros for
operating system recognition is particularly fragile, but why any
other non-compiler specific file, even if fixincluded, should be
significantly safer.

I also still think <sys/types.h> is better than <stdio.h> for this
particular test, as glibc targets (and other others) may attempt clever
things with inline macro versions of sprintf, printf and friends that
would interfere with GCC's optimizations of sprintf->strcpy, and
printf->puts, etc..  For example, see /usr/include/bits/stdio.h on
any linux box.  Indeed, this is the reason for the comment about
why <math.h> wasn't used.


Your changes as currently written also introduce a regression that
we no longer diagnose platforms that are incorrectly determined to
be C99 (not just newlib targets).  The reason platforms like HP-UX and
IRIX are explicitly listed in builtins-config.h is to prevent these test
cases failing.  Adding weak definitions of cabsf, subverts the whole
raison-d'etre for a HAVE_C99_RUNTIME macro.

Roger
--


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