Index: inclhack.def =================================================================== --- inclhack.def (revision 132531) +++ inclhack.def (working copy) @@ -3089,7 +3089,37 @@ "#undef isunordered\n" "#define isunordered(x, y) ((x) __builtin_isunordered(y))"; }; +/* + * On Solaris 11, if you do isinf(NaN) you'll get a floating point + * exception. Provide an alternative using GCC's builtin macros. + */ +fix = { + hackname = solaris_math_10; + select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = "#define isinf(x)\t__extension__ ( {\t\t\t\t\\\n" + "\t\t\tconst __typeof(x) __x_i = (x);\t\t\t\\\n" + "\t\t\t__builtin_expect(sizeof(__x_i) == sizeof(float)\t\\\n" + "\t\t\t? isgreater(__builtin_fabsf(__x_i),__FLT_MAX__) \\\n" + "\t\t\t: sizeof(__x_i) == sizeof(long double)\t\t\\\n" + "\t\t\t? isgreater(__builtin_fabsl(__x_i),__LDBL_MAX__)\\\n" + "\t\t\t: isgreater(__builtin_fabs(__x_i),__DBL_MAX__), 0);\\\n" + "\t})"; + c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n" + "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);[ \t]*\\\\\n" + "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*INFINITY[ \t]*\\|\\|[ \t]*\\\\\n" + "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*\\(-INFINITY\\);[ \t]*\\}\\)"; + test_text = + '#pragma ident "@(#)math_c99.h 1.12 07/01/21 SMI"'"\n" + "#undef isinf\n" + "#define isinf(x) __extension__( \\\\\n" + " { __typeof(x) __x_i = (x); \\\\\n" + " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n" + " __x_i == (__typeof(__x_i)) (-INFINITY); })"; +}; + /* * Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER * incorrectly, so we replace them with versions that correspond to Index: tests/base/iso/math_c99.h =================================================================== --- tests/base/iso/math_c99.h (revision 132531) +++ tests/base/iso/math_c99.h (working copy) @@ -117,3 +117,17 @@ #undef isunordered #define isunordered(x, y) __builtin_isunordered(x, y) #endif /* SOLARIS_MATH_9_CHECK */ + + +#if defined( SOLARIS_MATH_10_CHECK ) +#pragma ident "@(#)math_c99.h 1.12 07/01/21 SMI" +#undef isinf +#define isinf(x) __extension__ ( { \ + const __typeof(x) __x_i = (x); \ + __builtin_expect(sizeof(__x_i) == sizeof(float) \ + ? isgreater(__builtin_fabsf(__x_i),__FLT_MAX__) \ + : sizeof(__x_i) == sizeof(long double) \ + ? isgreater(__builtin_fabsl(__x_i),__LDBL_MAX__)\ + : isgreater(__builtin_fabs(__x_i),__DBL_MAX__), 0);\ + }) +#endif /* SOLARIS_MATH_10_CHECK */