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,

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.

Fair enough then. In which case are there any objections to my applying this patch ? I have verified that it fixes the unexpected failures of the gcc.dg/builtins-18.c and gcc.dg/builtins-20.c tests for the arm-elf toolchain.


Cheers
  Nick

gcc/testsuite/ChangeLog
2004-12-03  Nick Clifton  <nickc@redhat.com>

	* gcc.dg/builtins-config.h: Use <sys/types.h> instead of
	<limits.h> because the latter comes from gcc's include/ directory
	and not the newlib/libc/include directory.

Index: gcc/testsuite/gcc.dg/builtins-config.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/builtins-config.h,v
retrieving revision 1.6
diff -c -3 -p -r1.6 builtins-config.h
*** gcc/testsuite/gcc.dg/builtins-config.h	3 Sep 2004 18:09:33 -0000	1.6
--- gcc/testsuite/gcc.dg/builtins-config.h	3 Dec 2004 14:07:51 -0000
***************
*** 23,35 ****
  /* Newlib has the "f" variants of the math functions, but not the "l"
     variants.  TARGET_C99_FUNCTIONS is only defined if all C99
     functions are present.  Therefore, on systems using newlib, tests
!    of builtins will fail for both the "f" and the "l" variants, and we
!    should therefore not define HAVE_C99_RUNTIME.  Including <limits.h>
!    gives us a way of seeing if _NEWLIB_VERSION is defined.  Include
!    <math.h> would work too, but the GLIBC math inlines cause us to
!    generate inferior code, which causes the test to fail, so it is
!    not safe to include <math.h>.  */
! #include <limits.h>
  #ifdef _NEWLIB_VERSION
  #else
  #define HAVE_C99_RUNTIME
--- 23,36 ----
  /* Newlib has the "f" variants of the math functions, but not the "l"
     variants.  TARGET_C99_FUNCTIONS is only defined if all C99
     functions are present.  Therefore, on systems using newlib, tests
!    of builtins will fail the "l" variants, and we should therefore not
!    define HAVE_C99_RUNTIME.  Including <sys/types.h> gives us a way of
!    seeing if _NEWLIB_VERSION is defined.  Including <math.h> would work
!    too, but the GLIBC math inlines cause us to generate inferior code,
!    which causes the test to fail, so it is not safe.  Including <limits.h>
!    also fails because the include search paths are ordered such that GCC's
!    version will be found before the newlib version.  */
! #include <sys/types.h>
  #ifdef _NEWLIB_VERSION
  #else
  #define HAVE_C99_RUNTIME

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