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]

[PATCH] fix-includes for darwin's math.h testing __APPLE_CC__ instead of __GNUC__


For the following testcase:


#include <math.h> const volatile static float arg2_float_23 = NAN;

NAN should be allowed in this situation as allowed by C99
but since darwin's headers do:
#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)
#define NAN __builtin_nanf("0x7fc00000") /* Constant expression, can be used as initializer. */
#else
#define NAN __nan( )
#endif


we get NAN as a function call to __nan which is not a constant value as we reject the code.
Since we can fixincludes the check of __APPLE_CC__ to be instead a check on what version
of GCC we are using, it fixes the bug. But that does not work for powerpc-darwin7.9 as we
already fix-included math.h by making a new one so we change just define __APPLE_CC__ as 1345 in that new header to get around the problem here (undefine it afterwards).



OK? Bootstrapped and tested on powerpc-darwin with no regressions (and tested fix-includes
also with no regressions).


Thanks,
Andrew Pinski

ChangeLog:

PR target/15642
* inclhack.def (AAB_darwin7_9_long_double_funcs [replace}): Define __APPLE_CC_
as 1345.
(broken_nan): New.
* fixincl.x: Regenerate.


Attachment: t.diff.txt
Description: Text document


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