summaryrefslogtreecommitdiffstats
path: root/fixincludes
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-06-21 19:18:18 +0000
committerIain Sandoe <iains@gcc.gnu.org>2019-06-21 19:18:18 +0000
commit5a50aed32ab80022a592091af011f6f0429d269a (patch)
tree5011a01629a2272159f6ed815d00b5c380275230 /fixincludes
parent[Darwin, fixincludes] Fix Darwin14 header issues. (diff)
downloadgcc-5a50aed32ab80022a592091af011f6f0429d269a.tar.gz
gcc-5a50aed32ab80022a592091af011f6f0429d269a.tar.bz2
gcc-5a50aed32ab80022a592091af011f6f0429d269a.tar.xz
[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
Diffstat (limited to 'fixincludes')
-rw-r--r--fixincludes/ChangeLog10
-rw-r--r--fixincludes/fixincl.x54
-rw-r--r--fixincludes/inclhack.def24
-rw-r--r--fixincludes/tests/base/architecture/ppc/math.h5
4 files changed, 83 insertions, 10 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 49135f038a0..be02029daff 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,5 +1,15 @@
12019-06-21 Iain Sandoe <iain@sandoe.co.uk> 12019-06-21 Iain Sandoe <iain@sandoe.co.uk>
2 2
3 * inclhack.def: Replace the complex test using __STRICT_ANSI__ and
4 __STDC_VERSION__ with a test using __DARWIN_NO_LONG_LONG.
5 Ensure that the top level math.h uses <> to wrap included headers
6 rather than "".
7 * fixincl.x: Regenerated.
8 * tests/base/architecture/ppc/math.h: Update test to include the
9 __DARWIN_NO_LONG_LONG case.
10
112019-06-21 Iain Sandoe <iain@sandoe.co.uk>
12
3 * inclhack.def: Guard __has_attribute and __has_extension in 13 * inclhack.def: Guard __has_attribute and __has_extension in
4 os/base.h. 14 os/base.h.
5 Guard Apple blocks syntax in dispatch/object.h. 15 Guard Apple blocks syntax in dispatch/object.h.
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 7b505845bda..b9e02985843 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
2 * 2 *
3 * DO NOT EDIT THIS FILE (fixincl.x) 3 * DO NOT EDIT THIS FILE (fixincl.x)
4 * 4 *
5 * It has been AutoGen-ed May 13, 2019 at 04:17:28 PM by AutoGen 5.17.4 5 * It has been AutoGen-ed June 21, 2019 at 08:06:27 PM by AutoGen 5.17.4
6 * From the definitions inclhack.def 6 * From the definitions inclhack.def
7 * and the template file fixincl 7 * and the template file fixincl
8 */ 8 */
9/* DO NOT SVN-MERGE THIS FILE, EITHER Mon May 13 16:17:28 BST 2019 9/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Jun 21 20:06:27 BST 2019
10 * 10 *
11 * You must regenerate it. Use the ./genfixes script. 11 * You must regenerate it. Use the ./genfixes script.
12 * 12 *
@@ -15,7 +15,7 @@
15 * certain ANSI-incompatible system header files which are fixed to work 15 * certain ANSI-incompatible system header files which are fixed to work
16 * correctly with ANSI C and placed in a directory that GNU C will search. 16 * correctly with ANSI C and placed in a directory that GNU C will search.
17 * 17 *
18 * This file contains 254 fixup descriptions. 18 * This file contains 255 fixup descriptions.
19 * 19 *
20 * See README for more information. 20 * See README for more information.
21 * 21 *
@@ -2650,7 +2650,7 @@ tSCC zDarwin_9_Long_Double_Funcs_2List[] =
2650 * Machine/OS name selection pattern 2650 * Machine/OS name selection pattern
2651 */ 2651 */
2652tSCC* apzDarwin_9_Long_Double_Funcs_2Machs[] = { 2652tSCC* apzDarwin_9_Long_Double_Funcs_2Machs[] = {
2653 "*-*-darwin7.9*", 2653 "*-*-darwin*",
2654 (const char*)NULL }; 2654 (const char*)NULL };
2655 2655
2656/* 2656/*
@@ -2756,6 +2756,42 @@ static const char* apzDarwin_Gcc4_BreakagePatch[] = {
2756 2756
2757/* * * * * * * * * * * * * * * * * * * * * * * * * * 2757/* * * * * * * * * * * * * * * * * * * * * * * * * *
2758 * 2758 *
2759 * Description of Darwin_Ll_Funcs_Avail fix
2760 */
2761tSCC zDarwin_Ll_Funcs_AvailName[] =
2762 "darwin_ll_funcs_avail";
2763
2764/*
2765 * File name selection pattern
2766 */
2767tSCC zDarwin_Ll_Funcs_AvailList[] =
2768 "architecture/ppc/math.h\0architecture/i386/math.h\0";
2769/*
2770 * Machine/OS name selection pattern
2771 */
2772tSCC* apzDarwin_Ll_Funcs_AvailMachs[] = {
2773 "*-*-darwin*",
2774 (const char*)NULL };
2775
2776/*
2777 * content selection pattern - do fix if pattern found
2778 */
2779tSCC zDarwin_Ll_Funcs_AvailSelect0[] =
2780 "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*__STRICT_ANSI__[^_]*__GNUC__[^)]*";
2781
2782#define DARWIN_LL_FUNCS_AVAIL_TEST_CT 1
2783static tTestDesc aDarwin_Ll_Funcs_AvailTests[] = {
2784 { TT_EGREP, zDarwin_Ll_Funcs_AvailSelect0, (regex_t*)NULL }, };
2785
2786/*
2787 * Fix Command Arguments for Darwin_Ll_Funcs_Avail
2788 */
2789static const char* apzDarwin_Ll_Funcs_AvailPatch[] = { sed_cmd_z,
2790 "-e", "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*__STRICT_ANSI__[^_]*__GNUC__[^\\)]*)/#if !(__DARWIN_NO_LONG_LONG)/",
2791 (char*)NULL };
2792
2793/* * * * * * * * * * * * * * * * * * * * * * * * * *
2794 *
2759 * Description of Darwin_Longjmp_Noreturn fix 2795 * Description of Darwin_Longjmp_Noreturn fix
2760 */ 2796 */
2761tSCC zDarwin_Longjmp_NoreturnName[] = 2797tSCC zDarwin_Longjmp_NoreturnName[] =
@@ -10310,9 +10346,9 @@ static const char* apzX11_SprintfPatch[] = {
10310 * 10346 *
10311 * List of all fixes 10347 * List of all fixes
10312 */ 10348 */
10313#define REGEX_COUNT 292 10349#define REGEX_COUNT 293
10314#define MACH_LIST_SIZE_LIMIT 187 10350#define MACH_LIST_SIZE_LIMIT 187
10315#define FIX_COUNT 254 10351#define FIX_COUNT 255
10316 10352
10317/* 10353/*
10318 * Enumerate the fixes 10354 * Enumerate the fixes
@@ -10383,6 +10419,7 @@ typedef enum {
10383 DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX, 10419 DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX,
10384 DARWIN_EXTERNC_FIXIDX, 10420 DARWIN_EXTERNC_FIXIDX,
10385 DARWIN_GCC4_BREAKAGE_FIXIDX, 10421 DARWIN_GCC4_BREAKAGE_FIXIDX,
10422 DARWIN_LL_FUNCS_AVAIL_FIXIDX,
10386 DARWIN_LONGJMP_NORETURN_FIXIDX, 10423 DARWIN_LONGJMP_NORETURN_FIXIDX,
10387 DARWIN_OS_TRACE_1_FIXIDX, 10424 DARWIN_OS_TRACE_1_FIXIDX,
10388 DARWIN_OS_TRACE_2_FIXIDX, 10425 DARWIN_OS_TRACE_2_FIXIDX,
@@ -10900,6 +10937,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
10900 DARWIN_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, 10937 DARWIN_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
10901 aDarwin_Gcc4_BreakageTests, apzDarwin_Gcc4_BreakagePatch, 0 }, 10938 aDarwin_Gcc4_BreakageTests, apzDarwin_Gcc4_BreakagePatch, 0 },
10902 10939
10940 { zDarwin_Ll_Funcs_AvailName, zDarwin_Ll_Funcs_AvailList,
10941 apzDarwin_Ll_Funcs_AvailMachs,
10942 DARWIN_LL_FUNCS_AVAIL_TEST_CT, FD_MACH_ONLY,
10943 aDarwin_Ll_Funcs_AvailTests, apzDarwin_Ll_Funcs_AvailPatch, 0 },
10944
10903 { zDarwin_Longjmp_NoreturnName, zDarwin_Longjmp_NoreturnList, 10945 { zDarwin_Longjmp_NoreturnName, zDarwin_Longjmp_NoreturnList,
10904 apzDarwin_Longjmp_NoreturnMachs, 10946 apzDarwin_Longjmp_NoreturnMachs,
10905 DARWIN_LONGJMP_NORETURN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, 10947 DARWIN_LONGJMP_NORETURN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 727f7d2cb28..861532c2a1d 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -1298,12 +1298,12 @@ fix = {
1298}; 1298};
1299 1299
1300/* 1300/*
1301 * For the AAB_darwin7_9_long_double_funcs fix to be useful, 1301 * For the AAB_darwin7_9_long_double_funcs fix (and later fixes for long long)
1302 * you have to not use "" includes. 1302 * to be useful, the main math.h must use <> and not "" includes.
1303 */ 1303 */
1304fix = { 1304fix = {
1305 hackname = darwin_9_long_double_funcs_2; 1305 hackname = darwin_9_long_double_funcs_2;
1306 mach = "*-*-darwin7.9*"; 1306 mach = "*-*-darwin*";
1307 files = math.h; 1307 files = math.h;
1308 select = '#include[ \t]+\"'; 1308 select = '#include[ \t]+\"';
1309 c_fix = format; 1309 c_fix = format;
@@ -1311,7 +1311,7 @@ fix = {
1311 1311
1312 c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"'; 1312 c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
1313 1313
1314 test_text = '#include "architecture/ppc/math.h"'; 1314 test_text = '#include <architecture/ppc/math.h>';
1315}; 1315};
1316 1316
1317/* 1317/*
@@ -1355,6 +1355,22 @@ fix = {
1355}; 1355};
1356 1356
1357/* 1357/*
1358 * math.h hides the long long functions that are available on the system for
1359 * 10.5 and 10.6 SDKs, we expect to use them in G++ without specifying a value
1360 * for __STDC_VERSION__, or switching __STRICT_ANSI__ off.
1361 */
1362fix = {
1363 hackname = darwin_ll_funcs_avail;
1364 mach = "*-*-darwin*";
1365 files = architecture/ppc/math.h, architecture/i386/math.h;
1366 select = "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*"
1367 "__STRICT_ANSI__[^_]*__GNUC__[^\)]*";
1368 sed = "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*"
1369 "__STRICT_ANSI__[^_]*__GNUC__[^\\)]*\)/#if\ !\(__DARWIN_NO_LONG_LONG\)/";
1370 test_text = "#if\ !(__DARWIN_NO_LONG_LONG)";
1371};
1372
1373/*
1358 * Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn. 1374 * Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn.
1359 */ 1375 */
1360fix = { 1376fix = {
diff --git a/fixincludes/tests/base/architecture/ppc/math.h b/fixincludes/tests/base/architecture/ppc/math.h
index 4af7808fcc2..e7db705f5f9 100644
--- a/fixincludes/tests/base/architecture/ppc/math.h
+++ b/fixincludes/tests/base/architecture/ppc/math.h
@@ -12,3 +12,8 @@
12#if defined( BROKEN_NAN_CHECK ) 12#if defined( BROKEN_NAN_CHECK )
13#if 1 13#if 1
14#endif /* BROKEN_NAN_CHECK */ 14#endif /* BROKEN_NAN_CHECK */
15
16
17#if defined( DARWIN_LL_FUNCS_AVAIL_CHECK )
18#if !(__DARWIN_NO_LONG_LONG)
19#endif /* DARWIN_LL_FUNCS_AVAIL_CHECK */