From: Roger Sayle Date: Sun, 15 Aug 2004 01:27:43 +0000 (+0000) Subject: backport: re PR libfortran/15930 ([irix6.5] gfortran libraries not built) X-Git-Tag: releases/gcc-3.3.5~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85a298822544a3af8794c12f3be463b63b982c6c;p=thirdparty%2Fgcc.git backport: re PR libfortran/15930 ([irix6.5] gfortran libraries not built) Backport from mainline. PR libgfortran/15930 * fixinc/inclhack.def (irix___generic1, irix___generic2): New. * fixinc/fixincl.x: Regenerate. * fixinc/tests/base/internal/math_core.h: New file Co-Authored-By: David Billinghurst From-SVN: r86017 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a64568f9cb4..cc9f6eb8a928 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-08-14 Roger Sayle + David Billinghurst + + PR libgfortran/15930 + * fixinc/inclhack.def (irix___generic1, irix___generic2): New. + * fixinc/fixincl.x: Regenerate. + * fixinc/tests/base/internal/math_core.h: New file + 2004-08-08 Roger Sayle PR middle-end/16790 diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x index c2d27b0414b5..c9cbf3acbda3 100644 --- a/gcc/fixinc/fixincl.x +++ b/gcc/fixinc/fixincl.x @@ -5,7 +5,7 @@ * files which are fixed to work correctly with ANSI C and placed in a * directory that GNU C will search. * - * This file contains 164 fixup descriptions. + * This file contains 166 fixup descriptions. * * See README for more information. * @@ -2672,6 +2672,88 @@ static const char* apzIrix___RestrictPatch[] = { # endif", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Irix___Generic1 fix + */ +tSCC zIrix___Generic1Name[] = + "irix___generic1"; + +/* + * File name selection pattern + */ +tSCC zIrix___Generic1List[] = + "|internal/math_core.h|"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzIrix___Generic1Machs[] = { + "mips-sgi-irix6.5", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zIrix___Generic1Select0[] = + "#define ([a-z]+)\\(x\\) *__generic.*"; + +#define IRIX___GENERIC1_TEST_CT 1 +static tTestDesc aIrix___Generic1Tests[] = { + { TT_EGREP, zIrix___Generic1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Irix___Generic1 + */ +static const char* apzIrix___Generic1Patch[] = { + "format", + "extern int %1(double);\n\ +extern int %1f(float);\n\ +extern int %1l(long double);\n\ +#define %1(x) (sizeof(x) == sizeof(double) ? _%1(x) \\\n\ + : sizeof(x) == sizeof(float) ? _%1f(x) \\\n\ + : _%1l(x))\n", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Irix___Generic2 fix + */ +tSCC zIrix___Generic2Name[] = + "irix___generic2"; + +/* + * File name selection pattern + */ +tSCC zIrix___Generic2List[] = + "|internal/math_core.h|"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzIrix___Generic2Machs[] = { + "mips-sgi-irix6.5", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zIrix___Generic2Select0[] = + "#define ([a-z]+)\\(x,y\\) *__generic.*"; + +#define IRIX___GENERIC2_TEST_CT 1 +static tTestDesc aIrix___Generic2Tests[] = { + { TT_EGREP, zIrix___Generic2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Irix___Generic2 + */ +static const char* apzIrix___Generic2Patch[] = { + "format", + "#define %1(x,y) \\\n\ + ((sizeof(x)<=4 && sizeof(y)<=4) ? _%1f(x,y) \\\n\ + : (sizeof(x)<=8 && sizeof(y)<=8) ? _%1(x,y) \\\n\ + : _%1l(x,y))\n", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Irix_Asm_Apostrophe fix @@ -6453,9 +6535,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 178 +#define REGEX_COUNT 180 #define MACH_LIST_SIZE_LIMIT 334 -#define FIX_COUNT 164 +#define FIX_COUNT 166 /* * Enumerate the fixes @@ -6526,6 +6608,8 @@ typedef enum { IO_QUOTES_USE_FIXIDX, IP_MISSING_SEMI_FIXIDX, IRIX___RESTRICT_FIXIDX, + IRIX___GENERIC1_FIXIDX, + IRIX___GENERIC2_FIXIDX, IRIX_ASM_APOSTROPHE_FIXIDX, IRIX_LIMITS_CONST_FIXIDX, IRIX_SOCKLEN_T_FIXIDX, @@ -6953,6 +7037,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = { IRIX___RESTRICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aIrix___RestrictTests, apzIrix___RestrictPatch, 0 }, + { zIrix___Generic1Name, zIrix___Generic1List, + apzIrix___Generic1Machs, + IRIX___GENERIC1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aIrix___Generic1Tests, apzIrix___Generic1Patch, 0 }, + + { zIrix___Generic2Name, zIrix___Generic2List, + apzIrix___Generic2Machs, + IRIX___GENERIC2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aIrix___Generic2Tests, apzIrix___Generic2Patch, 0 }, + { zIrix_Asm_ApostropheName, zIrix_Asm_ApostropheList, apzIrix_Asm_ApostropheMachs, IRIX_ASM_APOSTROPHE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def index 959cb569da0b..534a0b419c43 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -1549,6 +1549,52 @@ fix = { test_text = "#ifdef __c99\n# define __restrict restrict"; }; +/* + * IRIX 6.5.22 uses the SGI c99 __generic() intrinsic + * to define the fpclasify, isfinite, isinf, isnan, isnormal and signbit + * functions. + * + * This was probably introduced around IRIX 6.5.18 + */ +fix = { + hackname = irix___generic1; + files = internal/math_core.h; + mach = "mips-sgi-irix6.5"; + select = "#define ([a-z]+)\\(x\\) *__generic.*"; + + c_fix = format; + c_fix_arg = "extern int %1(double);\n" + "extern int %1f(float);\n" + "extern int %1l(long double);\n" + "#define %1(x) (sizeof(x) == sizeof(double) ? _%1(x) \\\n" + " : sizeof(x) == sizeof(float) ? _%1f(x) \\\n" + " : _%1l(x))\n"; + + test_text = + "#define isnan(x) __generic(x,,, _isnan, _isnanf, _isnanl,,,)(x)\n"; +}; + + +/* Likewise on IRIX 6.5.19 and later uses the SGI + compiler's __generic intrinsic to define isgreater, isgreaterequal, + isless, islessequal, islessgreater and isunordered functions. */ +fix = { + hackname = irix___generic2; + files = internal/math_core.h; + mach = "mips-sgi-irix6.5"; + select = "#define ([a-z]+)\\(x,y\\) *__generic.*"; + + c_fix = format; + c_fix_arg = "#define %1(x,y) \\\n" + " ((sizeof(x)<=4 && sizeof(y)<=4) ? _%1f(x,y) \\\n" + " : (sizeof(x)<=8 && sizeof(y)<=8) ? _%1(x,y) \\\n" + " : _%1l(x,y))\n"; + + test_text = + "#define isless(x,y) __generic(x,y,, _isless, _islessf, _islessl,,,)(x,y)"; +}; + + /* * IRIX 5.2's contains an asm comment with a contraction * that causes the assembly preprocessor to complain about an