From: Iain Sandoe Date: Wed, 4 Sep 2019 19:06:36 +0000 (+0000) Subject: [Darwin, fixincludes] Backport fix for Darwin9/10 TR1 test fails. X-Git-Tag: releases/gcc-7.5.0~171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=318c48d7d7a3f10c1bf856282a8a54019c8ca890;p=thirdparty%2Fgcc.git [Darwin, fixincludes] Backport fix for Darwin9/10 TR1 test fails. 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. 2019-09-04 Iain Sandoe Backport from mainline. 2019-06-21 Iain Sandoe * 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: r275379 --- diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 96318b2d4f8e..9af41d400170 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,16 @@ +2019-09-04 Iain Sandoe + + Backport from mainline. + 2019-06-21 Iain Sandoe + + * 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-09-04 Iain Sandoe Backport from mainline. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index e95bccdf9fa1..cf5cc5faf130 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed August 29, 2019 at 12:20:01 AM by AutoGen 5.17.4 + * It has been AutoGen-ed August 29, 2019 at 12:22:26 AM by AutoGen 5.17.4 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Aug 29 00:20:01 BST 2019 +/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Aug 29 00:22:26 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 251 fixup descriptions. + * This file contains 252 fixup descriptions. * * See README for more information. * @@ -2638,7 +2638,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 }; /* @@ -2742,6 +2742,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 @@ -10261,9 +10297,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 288 +#define REGEX_COUNT 289 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 251 +#define FIX_COUNT 252 /* * Enumerate the fixes @@ -10332,6 +10368,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, @@ -10838,6 +10875,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, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 7fa3af4e4c85..acd84ba89930 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1364,12 +1364,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; @@ -1377,7 +1377,7 @@ fix = { c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"'; - test_text = '#include "architecture/ppc/math.h"'; + test_text = '#include '; }; /* @@ -1420,6 +1420,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 doesn't mark longjump noreturn. */ diff --git a/fixincludes/tests/base/architecture/ppc/math.h b/fixincludes/tests/base/architecture/ppc/math.h index 4af7808fcc22..e7db705f5f9a 100644 --- a/fixincludes/tests/base/architecture/ppc/math.h +++ b/fixincludes/tests/base/architecture/ppc/math.h @@ -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 */