backport: re PR libfortran/41169 (libgfortran fails to build on Solaris 10+: '_Imaginary_I' undeclared)

Backport from mainline:
	2009-09-02  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR libfortran/41169
	* inclhack.def (irix_complex): New fix.
	(solaris_complex): Likewise.
	* fixincl.x: Regenerate.
	* tests/base/complex.h [IRIX_COMPLEX_CHECK, SOLARIS_COMPLEX_CHECK]:
	New tests.

	2009-09-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* inclhack.def (solaris_complex): Remove superfluous backslashes from
	replacement string.  Replace \+ operator with \{1,\}.

From-SVN: r160166
This commit is contained in:
Rainer Orth 2010-06-02 16:49:39 +00:00 committed by Rainer Orth
parent 438ca7cf87
commit eb414873e1
4 changed files with 182 additions and 5 deletions

View File

@ -1,3 +1,20 @@
2010-06-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Backport from mainline:
2009-09-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR libfortran/41169
* inclhack.def (irix_complex): New fix.
(solaris_complex): Likewise.
* fixincl.x: Regenerate.
* tests/base/complex.h [IRIX_COMPLEX_CHECK, SOLARIS_COMPLEX_CHECK]:
New tests.
2009-09-08 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* inclhack.def (solaris_complex): Remove superfluous backslashes from
replacement string. Replace \+ operator with \{1,\}.
2010-04-29 Release Manager
* GCC 4.4.4 released.

View File

@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
* It has been AutoGen-ed Saturday February 28, 2009 at 10:11:41 AM PST
* It has been AutoGen-ed Wednesday June 2, 2010 at 06:48:24 PM MEST
* From the definitions inclhack.def
* and the template file fixincl
*/
/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Feb 28 10:11:41 PST 2009
/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Jun 2 18:48:24 MEST 2010
*
* 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 180 fixup descriptions.
* This file contains 182 fixup descriptions.
*
* See README for more information.
*
@ -3786,6 +3786,45 @@ static const char* apzIrix_Asm_ApostrophePatch[] = {
"^([ \t]*#.*[Ww]e)'re",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Irix_Complex fix
*/
tSCC zIrix_ComplexName[] =
"irix_complex";
/*
* File name selection pattern
*/
tSCC zIrix_ComplexList[] =
"complex.h\0";
/*
* Machine/OS name selection pattern
*/
tSCC* apzIrix_ComplexMachs[] = {
"mips-sgi-irix6.5",
(const char*)NULL };
/*
* content selection pattern - do fix if pattern found
*/
tSCC zIrix_ComplexSelect0[] =
"#define[ \t]_Complex_I[ \t]\\(\\(float[ \t]_Complex\\)[ \t]\\(__I__\\)\\)";
#define IRIX_COMPLEX_TEST_CT 1
static tTestDesc aIrix_ComplexTests[] = {
{ TT_EGREP, zIrix_ComplexSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Irix_Complex
*/
static const char* apzIrix_ComplexPatch[] = { sed_cmd_z,
"-e", "s/#define[ \t]_Complex_I[ \t]((float[ \t]_Complex)[ \t](__I__))/#define _Complex_I (__extension__ 1.0iF)/",
"-e", "/#define[ \t]imaginary[ \t]_Imaginary/d",
"-e", "/#define[ \t]_Imaginary_I/d",
"-e", "s/#define[ \t]I[ \t]_Imaginary_I/#define I _Complex_I/",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Irix_Limits_Const fix
@ -5299,6 +5338,45 @@ static const char* apzSco_MathPatch[] = { sed_cmd_z,
#endif /* ! __GNUC__ */",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Solaris_Complex fix
*/
tSCC zSolaris_ComplexName[] =
"solaris_complex";
/*
* File name selection pattern
*/
tSCC zSolaris_ComplexList[] =
"complex.h\0";
/*
* Machine/OS name selection pattern
*/
tSCC* apzSolaris_ComplexMachs[] = {
"*-*-solaris2.*",
(const char*)NULL };
/*
* content selection pattern - do fix if pattern found
*/
tSCC zSolaris_ComplexSelect0[] =
"#define[ \t]_Complex_I[ \t]_Complex_I";
#define SOLARIS_COMPLEX_TEST_CT 1
static tTestDesc aSolaris_ComplexTests[] = {
{ TT_EGREP, zSolaris_ComplexSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Solaris_Complex
*/
static const char* apzSolaris_ComplexPatch[] = { sed_cmd_z,
"-e", "s/#define[ \t]_Complex_I[ \t]_Complex_I/#define\t_Complex_I\t(__extension__ 1.0iF)/",
"-e", "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d",
"-e", "/#define[ \t]imaginary[ \t]_Imaginary/d",
"-e", "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Solaris_Math_1 fix
@ -7308,9 +7386,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
#define REGEX_COUNT 226
#define REGEX_COUNT 228
#define MACH_LIST_SIZE_LIMIT 181
#define FIX_COUNT 180
#define FIX_COUNT 182
/*
* Enumerate the fixes
@ -7408,6 +7486,7 @@ typedef enum {
IRIX___GENERIC1_FIXIDX,
IRIX___GENERIC2_FIXIDX,
IRIX_ASM_APOSTROPHE_FIXIDX,
IRIX_COMPLEX_FIXIDX,
IRIX_LIMITS_CONST_FIXIDX,
IRIX_SOCKLEN_T_FIXIDX,
IRIX_STDINT_C99_FIXIDX,
@ -7447,6 +7526,7 @@ typedef enum {
RS6000_FCHMOD_FIXIDX,
RS6000_PARAM_FIXIDX,
SCO_MATH_FIXIDX,
SOLARIS_COMPLEX_FIXIDX,
SOLARIS_MATH_1_FIXIDX,
SOLARIS_MATH_2_FIXIDX,
SOLARIS_MATH_3_FIXIDX,
@ -7959,6 +8039,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
IRIX_ASM_APOSTROPHE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aIrix_Asm_ApostropheTests, apzIrix_Asm_ApostrophePatch, 0 },
{ zIrix_ComplexName, zIrix_ComplexList,
apzIrix_ComplexMachs,
IRIX_COMPLEX_TEST_CT, FD_MACH_ONLY,
aIrix_ComplexTests, apzIrix_ComplexPatch, 0 },
{ zIrix_Limits_ConstName, zIrix_Limits_ConstList,
apzIrix_Limits_ConstMachs,
IRIX_LIMITS_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
@ -8154,6 +8239,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
SCO_MATH_TEST_CT, FD_MACH_ONLY,
aSco_MathTests, apzSco_MathPatch, 0 },
{ zSolaris_ComplexName, zSolaris_ComplexList,
apzSolaris_ComplexMachs,
SOLARIS_COMPLEX_TEST_CT, FD_MACH_ONLY,
aSolaris_ComplexTests, apzSolaris_ComplexPatch, 0 },
{ zSolaris_Math_1Name, zSolaris_Math_1List,
apzSolaris_Math_1Machs,
SOLARIS_MATH_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,

View File

@ -2065,6 +2065,29 @@ fix = {
};
/*
* IRIX 6.5 complex.h defines _Complex_I and _Imaginary_I in terms of __I__,
* which is a MIPSpro compiler builtin. Remove _Imaginary_I and imaginary
* definitions which are not supported by GCC.
*/
fix = {
hackname = irix_complex;
mach = "mips-sgi-irix6.5";
files = complex.h;
select = "#define[ \t]_Complex_I[ \t]\\(\\(float[ \t]_Complex\\)[ \t]\\(__I__\\)\\)";
sed = "s/#define[ \t]_Complex_I[ \t]((float[ \t]_Complex)[ \t](__I__))/"
"#define _Complex_I (__extension__ 1.0iF)/";
sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
sed = "/#define[ \t]_Imaginary_I/d";
sed = "s/#define[ \t]I[ \t]_Imaginary_I/#define I _Complex_I/";
test_text = "#define _Complex_I ((float _Complex) (__I__))\n"
"#define imaginary _Imaginary\n"
"// #define _Imaginary_I ((float _Imaginary) 1)\n"
"#define _Imaginary_I __I__\n"
"#define I _Imaginary_I";
};
/*
* Non-traditional "const" declaration in Irix's limits.h.
*/
@ -2806,6 +2829,30 @@ fix = {
};
/*
* Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
* themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
* and imaginary definitions which are not supported by GCC.
*/
fix = {
hackname = solaris_complex;
mach = "*-*-solaris2.*";
files = complex.h;
select = "#define[ \t]_Complex_I[ \t]_Complex_I";
sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
"#define\t_Complex_I\t(__extension__ 1.0iF)/";
sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
test_text = "#define _Complex_I _Complex_I\n"
"#define complex _Complex\n"
"#define _Imaginary_I _Imaginary_I\n"
"#define imaginary _Imaginary\n"
"#undef I\n"
"#define I _Imaginary_I";
};
/*
* Sun Solaris 10 defines several C99 math macros in terms of
* builtins specific to the Studio compiler, in particular not

View File

@ -0,0 +1,23 @@
/* DO NOT EDIT THIS FILE.
It has been auto-edited by fixincludes from:
"fixinc/tests/inc/complex.h"
This had to be done to correct non-standard usages in the
original, manufacturer supplied header file. */
#if defined( IRIX_COMPLEX_CHECK )
#define _Complex_I (__extension__ 1.0iF)
#define I _Complex_I
#endif /* IRIX_COMPLEX_CHECK */
#if defined( SOLARIS_COMPLEX_CHECK )
#define _Complex_I (__extension__ 1.0iF)
#define complex _Complex
#undef I
#define I _Complex_I
#endif /* SOLARIS_COMPLEX_CHECK */