From: Eric Botcazou Date: Sun, 29 May 2005 20:45:43 +0000 (+0200) Subject: re PR target/19933 (Problem with define of HUGE_VAL in math_c99.) X-Git-Tag: releases/gcc-3.4.5~398 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f62e73b6e7efc92667e7b963725519f8dbdd712;p=thirdparty%2Fgcc.git re PR target/19933 (Problem with define of HUGE_VAL in math_c99.) PR target/19933 * fixinc/inclhack.def (solaris_math_6_1): New fix. (solaris_math_9): Rewrite and guard with #ifdef __sparc__. * fixinc/fixincl.x: Regenerate. * fixinc/tests/base/iso/math_c99.h: Adjust for above changes. Backport from mainline: 2005-05-19 Eric Botcazou Joseph S. Myers * fixinc/inclhack.def: New fixes solaris_math_[1-9]. * fixinc/fixincl.x: Regenerate. * fixinc/tests/base/iso/math_c99.h: New. Backport from mainline: 2005-05-10 Joseph S. Myers * fixinc/inclhack.def (stdio_stdarg_h, stdio_va_list): Bypass on *-*-solaris2.1[0-9]*, not just *-*-solaris2.1[0-9]. * fixinc/fixincl.x: Regenerate. Backport from mainline: 2004-11-26 Mark Mitchell * fixinc/inclhack.def (gnu_types): Do not use on Solaris 2.1x. (stdio_va_list): Likewise. (stdio_stdarg.h): Likewise. (solaris_stdio_tag): Add bypass. * fixinc/fixincl.x: Regenerated. testsuite/ * gcc.dg/c99-math.h: New * gcc.dg/c99-math-float-1.c: New test. * gcc.dg/c99-math-double-1.c: Likewise. * gcc.dg/c99-math-long-double-1.c: Likewise. From-SVN: r100333 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 016f62a619c2..5eeb942e3458 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,35 @@ +2005-05-29 Eric Botcazou + + PR target/19933 + * fixinc/inclhack.def (solaris_math_6_1): New fix. + (solaris_math_9): Rewrite and guard with #ifdef __sparc__. + * fixinc/fixincl.x: Regenerate. + * fixinc/tests/base/iso/math_c99.h: Adjust for above changes. + + Backport from mainline: + 2005-05-19 Eric Botcazou + Joseph S. Myers + + * fixinc/inclhack.def: New fixes solaris_math_[1-9]. + * fixinc/fixincl.x: Regenerate. + * fixinc/tests/base/iso/math_c99.h: New. + + Backport from mainline: + 2005-05-10 Joseph S. Myers + + * fixinc/inclhack.def (stdio_stdarg_h, stdio_va_list): Bypass on + *-*-solaris2.1[0-9]*, not just *-*-solaris2.1[0-9]. + * fixinc/fixincl.x: Regenerate. + + Backport from mainline: + 2004-11-26 Mark Mitchell + + * fixinc/inclhack.def (gnu_types): Do not use on Solaris 2.1x. + (stdio_va_list): Likewise. + (stdio_stdarg.h): Likewise. + (solaris_stdio_tag): Add bypass. + * fixinc/fixincl.x: Regenerated. + 2005-05-26 Jakub Jelinek PR target/21716 diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x index 658e5a1af88d..e943e4c6a063 100644 --- a/gcc/fixinc/fixincl.x +++ b/gcc/fixinc/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Friday May 6, 2005 at 09:27:07 AM PDT + * It has been AutoGen-ed Saturday May 21, 2005 at 05:04:48 PM CEST * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT CVS-MERGE THIS FILE, EITHER Fri May 6 09:27:07 PDT 2005 +/* DO NOT CVS-MERGE THIS FILE, EITHER Sat May 21 17:04:48 CEST 2005 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 178 fixup descriptions. + * This file contains 188 fixup descriptions. * * See README for more information. * @@ -1927,7 +1927,9 @@ tSCC zGnu_TypesList[] = /* * Machine/OS name selection pattern */ -#define apzGnu_TypesMachs (const char**)NULL +tSCC* apzGnu_TypesMachs[] = { + "*-*-solaris2.1[0-9]*", + (const char*)NULL }; /* * content selection pattern - do fix if pattern found @@ -4519,6 +4521,472 @@ static const char* apzSco_UtimePatch[] = { "(const char *, const struct utimbuf *);", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_1 fix + */ +tSCC zSolaris_Math_1Name[] = + "solaris_math_1"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_1List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_1Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_1Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_1Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_1_TEST_CT 2 +static tTestDesc aSolaris_Math_1Tests[] = { + { TT_NEGREP, zSolaris_Math_1Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_1 + */ +static const char* apzSolaris_Math_1Patch[] = { + "format", + "#define\tHUGE_VA%1\t(__builtin_huge_va%2())", + "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_2 fix + */ +tSCC zSolaris_Math_2Name[] = + "solaris_math_2"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_2List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_2Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_2Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_2Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_2_TEST_CT 2 +static tTestDesc aSolaris_Math_2Tests[] = { + { TT_NEGREP, zSolaris_Math_2Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_2 + */ +static const char* apzSolaris_Math_2Patch[] = { + "format", + "#define\tINFINITY\t(__builtin_inff())", + "^#define[ \t]+INFINITY[ \t]+__builtin_infinity", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_3 fix + */ +tSCC zSolaris_Math_3Name[] = + "solaris_math_3"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_3List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_3Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_3Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_3Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_3_TEST_CT 2 +static tTestDesc aSolaris_Math_3Tests[] = { + { TT_NEGREP, zSolaris_Math_3Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_3Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_3 + */ +static const char* apzSolaris_Math_3Patch[] = { + "format", + "#define\tNAN\t\t(__builtin_nanf(\"\"))", + "^#define[ \t]+NAN[ \t]+__builtin_nan", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_4 fix + */ +tSCC zSolaris_Math_4Name[] = + "solaris_math_4"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_4List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_4Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_4Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_4Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_4_TEST_CT 2 +static tTestDesc aSolaris_Math_4Tests[] = { + { TT_NEGREP, zSolaris_Math_4Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_4Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_4 + */ +static const char* apzSolaris_Math_4Patch[] = { + "format", + "#define\tfpclassify(x) \\\n\ + __extension__ ({ __typeof(x) __x_fp = (x); \\\n\ +\t\t isnan(__x_fp) \\\n\ +\t\t ? FP_NAN \\\n\ +\t\t : isinf(__x_fp) \\\n\ +\t\t ? FP_INFINITE \\\n\ +\t\t : isnormal(__x_fp) \\\n\ +\t\t\t ? FP_NORMAL \\\n\ +\t\t\t : __x_fp == 0.0 \\\n\ +\t\t\t ? FP_ZERO \\\n\ +\t\t\t : FP_SUBNORMAL; })", + "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_5 fix + */ +tSCC zSolaris_Math_5Name[] = + "solaris_math_5"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_5List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_5Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_5Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_5Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_5_TEST_CT 2 +static tTestDesc aSolaris_Math_5Tests[] = { + { TT_NEGREP, zSolaris_Math_5Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_5Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_5 + */ +static const char* apzSolaris_Math_5Patch[] = { + "format", + "#define\tisfinite(x) \\\n\ + __extension__ ({ __typeof (x) __x_f = (x); \\\n\ +\t\t __builtin_expect(!isnan(__x_f - __x_f), 1); })", + "^#define[ \t]+isfinite\\(x\\)[ \t]+__builtin_isfinite\\(x\\)", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_6 fix + */ +tSCC zSolaris_Math_6Name[] = + "solaris_math_6"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_6List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_6Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_6Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_6Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_6_TEST_CT 2 +static tTestDesc aSolaris_Math_6Tests[] = { + { TT_NEGREP, zSolaris_Math_6Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_6Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_6 + */ +static const char* apzSolaris_Math_6Patch[] = { + "format", + "#define\tisinf(x) \\\n\ + __extension__ ({ __typeof (x) __x_i = (x); \\\n\ +\t\t __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); })", + "^#define[ \t]+isinf\\(x\\)[ \t]+__builtin_isinf\\(x\\)", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_6_1 fix + */ +tSCC zSolaris_Math_6_1Name[] = + "solaris_math_6_1"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_6_1List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_6_1Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_6_1Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_6_1Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_6_1_TEST_CT 2 +static tTestDesc aSolaris_Math_6_1Tests[] = { + { TT_NEGREP, zSolaris_Math_6_1Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_6_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_6_1 + */ +static const char* apzSolaris_Math_6_1Patch[] = { + "format", + "#define\tisnan(x) \\\n\ + __extension__ ({ __typeof (x) __x_a = (x); \\\n\ +\t\t __builtin_expect(__x_a != __x_a, 0); })", + "^#define[ \t]+isnan\\(x\\)[ \t]+__builtin_isnan\\(x\\)", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_7 fix + */ +tSCC zSolaris_Math_7Name[] = + "solaris_math_7"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_7List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_7Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_7Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_7Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_7_TEST_CT 2 +static tTestDesc aSolaris_Math_7Tests[] = { + { TT_NEGREP, zSolaris_Math_7Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_7Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_7 + */ +static const char* apzSolaris_Math_7Patch[] = { + "format", + "#define\tisnormal(x) \\\n\ + __extension__ ({ __typeof(x) __x_n = (x); \\\n\ +\t\t if (__x_n < 0.0) __x_n = -__x_n; \\\n\ +\t\t __builtin_expect(isfinite(__x_n) \\\n\ +\t\t\t\t && (sizeof(__x_n) == sizeof(float) \\\n\ +\t\t\t\t\t ? __x_n >= __FLT_MIN__ \\\n\ +\t\t\t\t\t : sizeof(__x_n) == sizeof(long double) \\\n\ +\t\t\t\t\t ? __x_n >= __LDBL_MIN__ \\\n\ +\t\t\t\t\t : __x_n >= __DBL_MIN__), 1); })", + "^#define[ \t]+isnormal\\(x\\)[ \t]+__builtin_isnormal\\(x\\)", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_8 fix + */ +tSCC zSolaris_Math_8Name[] = + "solaris_math_8"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_8List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_8Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_8Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_8Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_8_TEST_CT 2 +static tTestDesc aSolaris_Math_8Tests[] = { + { TT_NEGREP, zSolaris_Math_8Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_8Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_8 + */ +static const char* apzSolaris_Math_8Patch[] = { + "format", + "#ifdef __sparc__\n\ +#undef\tsignbit\n\ +#define\tsignbit(x) \\\n\ + (sizeof(x) == sizeof(float) \\\n\ + ? ({ union { float f; unsigned int i[1]; } __s; \\\n\ +\t__s.f = (x); __s.i[0] >> 31; }) \\\n\ + : sizeof(x) == sizeof(long double) \\\n\ + ? ({ union { long double f; unsigned int i[4]; } __s; \\\n\ +\t __s.f = (x); __s.i[0] >> 31; }) \\\n\ + : ({ union { double f; unsigned int i[2]; } __s; \\\n\ +\t __s.f = (x); __s.i[0] >> 31; }))\n\ +#endif /* __sparc__ */\n", + "^#undef[ \t]signbit\n\ +^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Math_9 fix + */ +tSCC zSolaris_Math_9Name[] = + "solaris_math_9"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Math_9List[] = + "|iso/math_c99.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzSolaris_Math_9Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Math_9Select0[] = + "@\\(#\\)math_c99.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Math_9Bypass0[] = + "__GNUC__"; + +#define SOLARIS_MATH_9_TEST_CT 2 +static tTestDesc aSolaris_Math_9Tests[] = { + { TT_NEGREP, zSolaris_Math_9Bypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Math_9Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Math_9 + */ +static const char* apzSolaris_Math_9Patch[] = { + "format", + "#define\t%1(x, y)%2__builtin_%1(x, y)", + "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Solaris_Mutex_Init_1 fix @@ -4653,8 +5121,15 @@ tSCC zSolaris_Stdio_TagList[] = tSCC zSolaris_Stdio_TagSelect0[] = "__cplusplus < 54321L"; -#define SOLARIS_STDIO_TAG_TEST_CT 1 +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Stdio_TagBypass0[] = + "__GNUC__"; + +#define SOLARIS_STDIO_TAG_TEST_CT 2 static tTestDesc aSolaris_Stdio_TagTests[] = { + { TT_NEGREP, zSolaris_Stdio_TagBypass0, (regex_t*)NULL }, { TT_EGREP, zSolaris_Stdio_TagSelect0, (regex_t*)NULL }, }; /* @@ -4804,7 +5279,9 @@ tSCC zStdio_Stdarg_HList[] = /* * Machine/OS name selection pattern */ -#define apzStdio_Stdarg_HMachs (const char**)NULL +tSCC* apzStdio_Stdarg_HMachs[] = { + "*-*-solaris2.1[0-9]*", + (const char*)NULL }; /* * content bypass pattern - skip fix if pattern found @@ -4840,7 +5317,9 @@ tSCC zStdio_Va_ListList[] = /* * Machine/OS name selection pattern */ -#define apzStdio_Va_ListMachs (const char**)NULL +tSCC* apzStdio_Va_ListMachs[] = { + "*-*-solaris2.1[0-9]*", + (const char*)NULL }; /* * content bypass pattern - skip fix if pattern found @@ -7059,9 +7538,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 200 +#define REGEX_COUNT 221 #define MACH_LIST_SIZE_LIMIT 261 -#define FIX_COUNT 178 +#define FIX_COUNT 188 /* * Enumerate the fixes @@ -7179,6 +7658,16 @@ typedef enum { SCO_REGSET_FIXIDX, SCO_STATIC_FUNC_FIXIDX, SCO_UTIME_FIXIDX, + SOLARIS_MATH_1_FIXIDX, + SOLARIS_MATH_2_FIXIDX, + SOLARIS_MATH_3_FIXIDX, + SOLARIS_MATH_4_FIXIDX, + SOLARIS_MATH_5_FIXIDX, + SOLARIS_MATH_6_FIXIDX, + SOLARIS_MATH_6_1_FIXIDX, + SOLARIS_MATH_7_FIXIDX, + SOLARIS_MATH_8_FIXIDX, + SOLARIS_MATH_9_FIXIDX, SOLARIS_MUTEX_INIT_1_FIXIDX, SOLARIS_MUTEX_INIT_2_FIXIDX, SOLARIS_SOCKET_FIXIDX, @@ -7475,7 +7964,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zGnu_TypesName, zGnu_TypesList, apzGnu_TypesMachs, - GNU_TYPES_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + GNU_TYPES_TEST_CT, FD_MACH_IFNOT | FD_SUBROUTINE, aGnu_TypesTests, apzGnu_TypesPatch, 0 }, { zHp_InlineName, zHp_InlineList, @@ -7808,6 +8297,56 @@ tFixDesc fixDescList[ FIX_COUNT ] = { SCO_UTIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aSco_UtimeTests, apzSco_UtimePatch, 0 }, + { zSolaris_Math_1Name, zSolaris_Math_1List, + apzSolaris_Math_1Machs, + SOLARIS_MATH_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_1Tests, apzSolaris_Math_1Patch, 0 }, + + { zSolaris_Math_2Name, zSolaris_Math_2List, + apzSolaris_Math_2Machs, + SOLARIS_MATH_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_2Tests, apzSolaris_Math_2Patch, 0 }, + + { zSolaris_Math_3Name, zSolaris_Math_3List, + apzSolaris_Math_3Machs, + SOLARIS_MATH_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_3Tests, apzSolaris_Math_3Patch, 0 }, + + { zSolaris_Math_4Name, zSolaris_Math_4List, + apzSolaris_Math_4Machs, + SOLARIS_MATH_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_4Tests, apzSolaris_Math_4Patch, 0 }, + + { zSolaris_Math_5Name, zSolaris_Math_5List, + apzSolaris_Math_5Machs, + SOLARIS_MATH_5_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_5Tests, apzSolaris_Math_5Patch, 0 }, + + { zSolaris_Math_6Name, zSolaris_Math_6List, + apzSolaris_Math_6Machs, + SOLARIS_MATH_6_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_6Tests, apzSolaris_Math_6Patch, 0 }, + + { zSolaris_Math_6_1Name, zSolaris_Math_6_1List, + apzSolaris_Math_6_1Machs, + SOLARIS_MATH_6_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_6_1Tests, apzSolaris_Math_6_1Patch, 0 }, + + { zSolaris_Math_7Name, zSolaris_Math_7List, + apzSolaris_Math_7Machs, + SOLARIS_MATH_7_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_7Tests, apzSolaris_Math_7Patch, 0 }, + + { zSolaris_Math_8Name, zSolaris_Math_8List, + apzSolaris_Math_8Machs, + SOLARIS_MATH_8_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_8Tests, apzSolaris_Math_8Patch, 0 }, + + { zSolaris_Math_9Name, zSolaris_Math_9List, + apzSolaris_Math_9Machs, + SOLARIS_MATH_9_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Math_9Tests, apzSolaris_Math_9Patch, 0 }, + { zSolaris_Mutex_Init_1Name, zSolaris_Mutex_Init_1List, apzSolaris_Mutex_Init_1Machs, SOLARIS_MUTEX_INIT_1_TEST_CT, FD_MACH_ONLY, @@ -7845,12 +8384,12 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zStdio_Stdarg_HName, zStdio_Stdarg_HList, apzStdio_Stdarg_HMachs, - STDIO_STDARG_H_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + STDIO_STDARG_H_TEST_CT, FD_MACH_IFNOT | FD_SUBROUTINE, aStdio_Stdarg_HTests, apzStdio_Stdarg_HPatch, 0 }, { zStdio_Va_ListName, zStdio_Va_ListList, apzStdio_Va_ListMachs, - STDIO_VA_LIST_TEST_CT, FD_MACH_ONLY, + STDIO_VA_LIST_TEST_CT, FD_MACH_IFNOT, aStdio_Va_ListTests, apzStdio_Va_ListPatch, 0 }, { zStrict_Ansi_NotName, zStrict_Ansi_NotList, diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def index cd85caed8361..bc0a6ff553f9 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -1144,6 +1144,9 @@ fix = { bypass = '_GCC_(PTRDIFF|SIZE|WCHAR)_T'; select = "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;"; c_fix = gnu_type; + /* The Solaris 10 headers already define these types correctly. */ + mach = '*-*-solaris2.1[0-9]*'; + not_machine = true; test_text = "typedef long int ptrdiff_t; /* long int */\n" "typedef uint_t size_t; /* uint_t */\n" @@ -2528,6 +2531,200 @@ fix = { test_text = "extern int utime(const char *, struct utimbuf *);"; }; +/* + * Sun Solaris 10 defines several C99 math macros in terms of + * builtins specific to the Studio compiler, in particular not + * compatible with the GNU compiler. + */ +fix = { + hackname = solaris_math_1; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())"; + c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef HUGE_VAL\n" + "#define HUGE_VAL __builtin_huge_val\n" + "#undef HUGE_VALF\n" + "#define HUGE_VALF __builtin_huge_valf\n" + "#undef HUGE_VALL\n" + "#define HUGE_VALL __builtin_huge_vall"; +}; + +fix = { + hackname = solaris_math_2; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\tINFINITY\t(__builtin_inff())"; + c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef INFINITY\n" + "#define INFINITY __builtin_infinity"; +}; + +fix = { + hackname = solaris_math_3; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))"; + c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef NAN\n" + "#define NAN __builtin_nan"; +}; + +fix = { + hackname = solaris_math_4; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\tfpclassify(x) \\\n" + " __extension__ ({ __typeof(x) __x_fp = (x); \\\n" + "\t\t isnan(__x_fp) \\\n" + "\t\t ? FP_NAN \\\n" + "\t\t : isinf(__x_fp) \\\n" + "\t\t ? FP_INFINITE \\\n" + "\t\t : isnormal(__x_fp) \\\n" + "\t\t\t ? FP_NORMAL \\\n" + "\t\t\t : __x_fp == 0.0 \\\n" + "\t\t\t ? FP_ZERO \\\n" + "\t\t\t : FP_SUBNORMAL; })"; + c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef fpclassify\n" + "#define fpclassify(x) __builtin_fpclassify(x)"; +}; + +fix = { + hackname = solaris_math_5; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\tisfinite(x) \\\n" + " __extension__ ({ __typeof (x) __x_f = (x); \\\n" + "\t\t __builtin_expect(!isnan(__x_f - __x_f), 1); })"; + c_fix_arg = "^#define[ \t]+isfinite\\(x\\)[ \t]+__builtin_isfinite\\(x\\)"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef isfinite\n" + "#define isfinite(x) __builtin_isfinite(x)"; +}; + +fix = { + hackname = solaris_math_6; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\tisinf(x) \\\n" + " __extension__ ({ __typeof (x) __x_i = (x); \\\n" + "\t\t __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); })"; + c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__builtin_isinf\\(x\\)"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef isinf\n" + "#define isinf(x) __builtin_isinf(x)"; +}; + +fix = { + hackname = solaris_math_6_1; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\tisnan(x) \\\n" + " __extension__ ({ __typeof (x) __x_a = (x); \\\n" + "\t\t __builtin_expect(__x_a != __x_a, 0); })"; + c_fix_arg = "^#define[ \t]+isnan\\(x\\)[ \t]+__builtin_isnan\\(x\\)"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef isnan\n" + "#define isnan(x) __builtin_isnan(x)"; +}; + +fix = { + hackname = solaris_math_7; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\tisnormal(x) \\\n" + " __extension__ ({ __typeof(x) __x_n = (x); \\\n" + "\t\t if (__x_n < 0.0) __x_n = -__x_n; \\\n" + "\t\t __builtin_expect(isfinite(__x_n) \\\n" + "\t\t\t\t && (sizeof(__x_n) == sizeof(float) \\\n" + "\t\t\t\t\t ? __x_n >= __FLT_MIN__ \\\n" + "\t\t\t\t\t : sizeof(__x_n) == sizeof(long double) \\\n" + "\t\t\t\t\t ? __x_n >= __LDBL_MIN__ \\\n" + "\t\t\t\t\t : __x_n >= __DBL_MIN__), 1); })"; + c_fix_arg = "^#define[ \t]+isnormal\\(x\\)[ \t]+__builtin_isnormal\\(x\\)"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef isnormal\n" + "#define isnormal(x) __builtin_isnormal(x)"; +}; + +fix = { + hackname = solaris_math_8; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#ifdef __sparc__\n" + "#undef\tsignbit\n" + "#define\tsignbit(x) \\\n" + " (sizeof(x) == sizeof(float) \\\n" + " ? ({ union { float f; unsigned int i[1]; } __s; \\\n" + "\t__s.f = (x); __s.i[0] >> 31; }) \\\n" + " : sizeof(x) == sizeof(long double) \\\n" + " ? ({ union { long double f; unsigned int i[4]; } __s; \\\n" + "\t __s.f = (x); __s.i[0] >> 31; }) \\\n" + " : ({ union { double f; unsigned int i[2]; } __s; \\\n" + "\t __s.f = (x); __s.i[0] >> 31; }))\n" + "#endif /* __sparc__ */\n"; + c_fix_arg = "^#undef[ \t]signbit\n" + "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef signbit\n" + "#define signbit(x) __builtin_signbit(x)"; +}; + +fix = { + hackname = solaris_math_9; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + bypass = "__GNUC__"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)"; + c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)"; + test_text = + '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" + "#undef isgreater\n" + "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n" + "#undef isgreaterequal\n" + "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n" + "#undef isless\n" + "#define isless(x, y) ((x) __builtin_isless(y))\n" + "#undef islessequal\n" + "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n" + "#undef islessgreater\n" + "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n" + "#undef isunordered\n" + "#define isunordered(x, y) ((x) __builtin_isunordered(y))"; +}; /* * Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER @@ -2607,6 +2804,9 @@ fix = { files = stdio_tag.h; select = '__cplusplus < 54321L'; + /* In Solaris 10, the code in stdio_tag.h is conditionalized on + "!defined(__GNUC__)" so we no longer need to fix it. */ + bypass = '__GNUC__'; sed = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/'; test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)"; @@ -2672,6 +2872,12 @@ fix = { hackname = stdio_stdarg_h; files = stdio.h; bypass = "include.*(stdarg\.h|machine/ansi\.h)"; + /* + * On Solaris 10, this fix is unnecessary; includes + * , which includes . + */ + mach = '*-*-solaris2.1[0-9]*'; + not_machine = true; c_fix = wrap; @@ -2698,6 +2904,13 @@ fix = { files = internal/stdio_core.h; files = internal/wchar_core.h; bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list'; + /* + * On Solaris 10, the definition in + * is guarded appropriately by the _XPG4 feature macro; + * there is therefore no need for this fix there. + */ + mach = '*-*-solaris2.1[0-9]*'; + not_machine = true; /* * Use __gnuc_va_list in arg types in place of va_list. diff --git a/gcc/fixinc/tests/base/iso/math_c99.h b/gcc/fixinc/tests/base/iso/math_c99.h new file mode 100644 index 000000000000..e8253abf2f62 --- /dev/null +++ b/gcc/fixinc/tests/base/iso/math_c99.h @@ -0,0 +1,128 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/iso/math_c99.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( SOLARIS_MATH_1_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef HUGE_VAL +#define HUGE_VAL (__builtin_huge_val()) +#undef HUGE_VALF +#define HUGE_VALF (__builtin_huge_valf()) +#undef HUGE_VALL +#define HUGE_VALL (__builtin_huge_vall()) +#endif /* SOLARIS_MATH_1_CHECK */ + + +#if defined( SOLARIS_MATH_2_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef INFINITY +#define INFINITY (__builtin_inff()) +#endif /* SOLARIS_MATH_2_CHECK */ + + +#if defined( SOLARIS_MATH_3_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef NAN +#define NAN (__builtin_nanf("")) +#endif /* SOLARIS_MATH_3_CHECK */ + + +#if defined( SOLARIS_MATH_4_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef fpclassify +#define fpclassify(x) \ + __extension__ ({ __typeof(x) __x_fp = (x); \ + isnan(__x_fp) \ + ? FP_NAN \ + : isinf(__x_fp) \ + ? FP_INFINITE \ + : isnormal(__x_fp) \ + ? FP_NORMAL \ + : __x_fp == 0.0 \ + ? FP_ZERO \ + : FP_SUBNORMAL; }) +#endif /* SOLARIS_MATH_4_CHECK */ + + +#if defined( SOLARIS_MATH_5_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef isfinite +#define isfinite(x) \ + __extension__ ({ __typeof (x) __x_f = (x); \ + __builtin_expect(!isnan(__x_f - __x_f), 1); }) +#endif /* SOLARIS_MATH_5_CHECK */ + + +#if defined( SOLARIS_MATH_6_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef isinf +#define isinf(x) \ + __extension__ ({ __typeof (x) __x_i = (x); \ + __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); }) +#endif /* SOLARIS_MATH_6_CHECK */ + + +#if defined( SOLARIS_MATH_6_1_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef isnan +#define isnan(x) \ + __extension__ ({ __typeof (x) __x_a = (x); \ + __builtin_expect(__x_a != __x_a, 0); }) +#endif /* SOLARIS_MATH_6_1_CHECK */ + + +#if defined( SOLARIS_MATH_7_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef isnormal +#define isnormal(x) \ + __extension__ ({ __typeof(x) __x_n = (x); \ + if (__x_n < 0.0) __x_n = -__x_n; \ + __builtin_expect(isfinite(__x_n) \ + && (sizeof(__x_n) == sizeof(float) \ + ? __x_n >= __FLT_MIN__ \ + : sizeof(__x_n) == sizeof(long double) \ + ? __x_n >= __LDBL_MIN__ \ + : __x_n >= __DBL_MIN__), 1); }) +#endif /* SOLARIS_MATH_7_CHECK */ + + +#if defined( SOLARIS_MATH_8_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#ifdef __sparc__ +#undef signbit +#define signbit(x) \ + (sizeof(x) == sizeof(float) \ + ? ({ union { float f; unsigned int i[1]; } __s; \ + __s.f = (x); __s.i[0] >> 31; }) \ + : sizeof(x) == sizeof(long double) \ + ? ({ union { long double f; unsigned int i[4]; } __s; \ + __s.f = (x); __s.i[0] >> 31; }) \ + : ({ union { double f; unsigned int i[2]; } __s; \ + __s.f = (x); __s.i[0] >> 31; })) +#endif /* __sparc__ */ + +#endif /* SOLARIS_MATH_8_CHECK */ + + +#if defined( SOLARIS_MATH_9_CHECK ) +#ident "@(#)math_c99.h 1.9 04/11/01 SMI" +#undef isgreater +#define isgreater(x, y) __builtin_isgreater(x, y) +#undef isgreaterequal +#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) +#undef isless +#define isless(x, y) __builtin_isless(x, y) +#undef islessequal +#define islessequal(x, y) __builtin_islessequal(x, y) +#undef islessgreater +#define islessgreater(x, y) __builtin_islessgreater(x, y) +#undef isunordered +#define isunordered(x, y) __builtin_isunordered(x, y) +#endif /* SOLARIS_MATH_9_CHECK */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e16116b0d7d..78eee781c6d4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2005-05-29 Eric Botcazou + + * gcc.dg/c99-math.h: New + * gcc.dg/c99-math-float-1.c: New test. + * gcc.dg/c99-math-double-1.c: Likewise. + * gcc.dg/c99-math-long-double-1.c: Likewise. + 2005-05-25 Roger Sayle PR middle-end/21709