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


Hi Roger,

2004-12-02 Nick Clifton <nickc@redhat.com>

	* gcc.dg/builtins-config.h: Remove test for _NEWLIB_VERSION as
	<limits.h> is now picked up from the gcc/include directory and
	not the newlib/libc/include directory.
       * gcc.dg/builtins-18.c: Provide weak aliases of functions not
	provided by newlib.
       * gcc.dg/builtins-20.c: Likewise.


My personal feeling is that this isn't the right way to do this.  The
purpose of builtins-config.h is to correctly set HAVE_C99_RUNTIME for
precisely those targets that have it.  Your change, rather than fixing
or correcting this definition for newlib targets, circumvents the tests
themselves by providing implementations of functions that HAVE_C99_RUNTIME
asserts we should already have.   Seems backward.

The source of the problem is that #include <limits.h> is no longer
guaranteed to define _NEWLIB_VERSION on newlib targets as we may now
get the compiler's limits.h instead.  As an alternative, might I suggest
that a suitable fix would be to include <sys/types.h> instead?  In fact,
any of newlib's headers that include <_ansi.h> and thereby <newlib.h>
would do.  The file <sys/types.h> is a reasonable candidate as it should
be portable, and shouldn't define any fancy macros like string.h, math.h,
stdio.h or stdlib.h that could interfere with the builtins tests
themselves.

Does this sound reasonable?  Could you check that it resolves the
testsuite failures you are seeing?

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>.


If however the list feels that this is the way to go then I will happily submit a revised patch.

Cheers
  Nick





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