[Darwin, fixincludes] Fix Darwin9/10 math.h issues.

Darwin has had long long functions for some considerable time and these are
exposed in Darwin8 and Darwin11+ headers.  However, for some reason it was
elected to hide them behind __STRICT_ANSI__ and __STDC_VERSION__ on Darwin9
and Darwin10.  This is a problem for G++/libstdc++ that expects the functions
to be available for strict ansi (-std=c++14, for example) and without
defining __STDC_VERSION__.  The fix here follows the pattern used in
Darwin11+ headers where the functions may be explicitly hidden by defining
__DARWIN_NO_LONG_LONG.

This fixes the tr1 testsuite fails seen on Darwin9 and 10.

2019-06-21  Iain Sandoe  <iain@sandoe.co.uk>

	* inclhack.def: Replace the complex test using __STRICT_ANSI__ and
	__STDC_VERSION__ with a test using __DARWIN_NO_LONG_LONG.
	Ensure that the top level math.h uses <> to wrap included headers
	rather than "".
	* fixincl.x: Regenerated.
	* tests/base/architecture/ppc/math.h: Update test to include the
	__DARWIN_NO_LONG_LONG case.

From-SVN: r272563
This commit is contained in:
Iain Sandoe 2019-06-21 19:18:18 +00:00 committed by Iain Sandoe
parent 59a0b1db75
commit 5a50aed32a
4 changed files with 83 additions and 10 deletions

View File

@ -1,3 +1,13 @@
2019-06-21 Iain Sandoe <iain@sandoe.co.uk>
* inclhack.def: Replace the complex test using __STRICT_ANSI__ and
__STDC_VERSION__ with a test using __DARWIN_NO_LONG_LONG.
Ensure that the top level math.h uses <> to wrap included headers
rather than "".
* fixincl.x: Regenerated.
* tests/base/architecture/ppc/math.h: Update test to include the
__DARWIN_NO_LONG_LONG case.
2019-06-21 Iain Sandoe <iain@sandoe.co.uk>
* inclhack.def: Guard __has_attribute and __has_extension in

View File

@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
* It has been AutoGen-ed May 13, 2019 at 04:17:28 PM by AutoGen 5.17.4
* It has been AutoGen-ed June 21, 2019 at 08:06:27 PM by AutoGen 5.17.4
* From the definitions inclhack.def
* and the template file fixincl
*/
/* DO NOT SVN-MERGE THIS FILE, EITHER Mon May 13 16:17:28 BST 2019
/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Jun 21 20:06:27 BST 2019
*
* 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 254 fixup descriptions.
* This file contains 255 fixup descriptions.
*
* See README for more information.
*
@ -2650,7 +2650,7 @@ tSCC zDarwin_9_Long_Double_Funcs_2List[] =
* Machine/OS name selection pattern
*/
tSCC* apzDarwin_9_Long_Double_Funcs_2Machs[] = {
"*-*-darwin7.9*",
"*-*-darwin*",
(const char*)NULL };
/*
@ -2754,6 +2754,42 @@ static const char* apzDarwin_Gcc4_BreakagePatch[] = {
"((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Darwin_Ll_Funcs_Avail fix
*/
tSCC zDarwin_Ll_Funcs_AvailName[] =
"darwin_ll_funcs_avail";
/*
* File name selection pattern
*/
tSCC zDarwin_Ll_Funcs_AvailList[] =
"architecture/ppc/math.h\0architecture/i386/math.h\0";
/*
* Machine/OS name selection pattern
*/
tSCC* apzDarwin_Ll_Funcs_AvailMachs[] = {
"*-*-darwin*",
(const char*)NULL };
/*
* content selection pattern - do fix if pattern found
*/
tSCC zDarwin_Ll_Funcs_AvailSelect0[] =
"#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*__STRICT_ANSI__[^_]*__GNUC__[^)]*";
#define DARWIN_LL_FUNCS_AVAIL_TEST_CT 1
static tTestDesc aDarwin_Ll_Funcs_AvailTests[] = {
{ TT_EGREP, zDarwin_Ll_Funcs_AvailSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Darwin_Ll_Funcs_Avail
*/
static const char* apzDarwin_Ll_Funcs_AvailPatch[] = { sed_cmd_z,
"-e", "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*__STRICT_ANSI__[^_]*__GNUC__[^\\)]*)/#if !(__DARWIN_NO_LONG_LONG)/",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Darwin_Longjmp_Noreturn fix
@ -10310,9 +10346,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
#define REGEX_COUNT 292
#define REGEX_COUNT 293
#define MACH_LIST_SIZE_LIMIT 187
#define FIX_COUNT 254
#define FIX_COUNT 255
/*
* Enumerate the fixes
@ -10383,6 +10419,7 @@ typedef enum {
DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX,
DARWIN_EXTERNC_FIXIDX,
DARWIN_GCC4_BREAKAGE_FIXIDX,
DARWIN_LL_FUNCS_AVAIL_FIXIDX,
DARWIN_LONGJMP_NORETURN_FIXIDX,
DARWIN_OS_TRACE_1_FIXIDX,
DARWIN_OS_TRACE_2_FIXIDX,
@ -10900,6 +10937,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
DARWIN_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aDarwin_Gcc4_BreakageTests, apzDarwin_Gcc4_BreakagePatch, 0 },
{ zDarwin_Ll_Funcs_AvailName, zDarwin_Ll_Funcs_AvailList,
apzDarwin_Ll_Funcs_AvailMachs,
DARWIN_LL_FUNCS_AVAIL_TEST_CT, FD_MACH_ONLY,
aDarwin_Ll_Funcs_AvailTests, apzDarwin_Ll_Funcs_AvailPatch, 0 },
{ zDarwin_Longjmp_NoreturnName, zDarwin_Longjmp_NoreturnList,
apzDarwin_Longjmp_NoreturnMachs,
DARWIN_LONGJMP_NORETURN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,

View File

@ -1298,12 +1298,12 @@ fix = {
};
/*
* For the AAB_darwin7_9_long_double_funcs fix to be useful,
* you have to not use "" includes.
* For the AAB_darwin7_9_long_double_funcs fix (and later fixes for long long)
* to be useful, the main math.h must use <> and not "" includes.
*/
fix = {
hackname = darwin_9_long_double_funcs_2;
mach = "*-*-darwin7.9*";
mach = "*-*-darwin*";
files = math.h;
select = '#include[ \t]+\"';
c_fix = format;
@ -1311,7 +1311,7 @@ fix = {
c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
test_text = '#include "architecture/ppc/math.h"';
test_text = '#include <architecture/ppc/math.h>';
};
/*
@ -1354,6 +1354,22 @@ fix = {
"(__GNUC_MINOR__ >= 1)\n";
};
/*
* math.h hides the long long functions that are available on the system for
* 10.5 and 10.6 SDKs, we expect to use them in G++ without specifying a value
* for __STDC_VERSION__, or switching __STRICT_ANSI__ off.
*/
fix = {
hackname = darwin_ll_funcs_avail;
mach = "*-*-darwin*";
files = architecture/ppc/math.h, architecture/i386/math.h;
select = "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*"
"__STRICT_ANSI__[^_]*__GNUC__[^\)]*";
sed = "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*"
"__STRICT_ANSI__[^_]*__GNUC__[^\\)]*\)/#if\ !\(__DARWIN_NO_LONG_LONG\)/";
test_text = "#if\ !(__DARWIN_NO_LONG_LONG)";
};
/*
* Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn.
*/

View File

@ -12,3 +12,8 @@
#if defined( BROKEN_NAN_CHECK )
#if 1
#endif /* BROKEN_NAN_CHECK */
#if defined( DARWIN_LL_FUNCS_AVAIL_CHECK )
#if !(__DARWIN_NO_LONG_LONG)
#endif /* DARWIN_LL_FUNCS_AVAIL_CHECK */