[gcc/devel/omp/gcc-9] Darwin, fixincludes - backport fixes Darwin9/10 math.h issues.

Tobias Burnus burnus@gcc.gnu.org
Thu Mar 5 14:16:00 GMT 2020


https://gcc.gnu.org/g:7146dba1ff6e5f4a9710bc5f7d66a999038c3b60

commit 7146dba1ff6e5f4a9710bc5f7d66a999038c3b60
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Aug 3 19:21:08 2019 +0000

    Darwin, fixincludes - backport fixes 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-08-03  Iain Sandoe  <iain@sandoe.co.uk>
    
    	Backport from mainline.
    	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: r274040

Diff:
---
 fixincludes/ChangeLog                          | 13 +++++++
 fixincludes/fixincl.x                          | 54 +++++++++++++++++++++++---
 fixincludes/inclhack.def                       | 24 ++++++++++--
 fixincludes/tests/base/architecture/ppc/math.h |  5 +++
 4 files changed, 86 insertions(+), 10 deletions(-)

diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 76b2b84..b829ea1 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -3,6 +3,19 @@
 	Backport from mainline.
 	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-08-03  Iain Sandoe  <iain@sandoe.co.uk>
+
+	Backport from mainline.
+	2019-06-21  Iain Sandoe  <iain@sandoe.co.uk>
+
 	* inclhack.def: Guard __has_attribute and __has_extension in
 	os/base.h.
 	Guard Apple blocks syntax in dispatch/object.h.
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 473694f..802162b 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  July  7, 2019 at 11:41:47 AM by AutoGen 5.17.4
+ * It has been AutoGen-ed  July  7, 2019 at 11:43:37 AM by AutoGen 5.17.4
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Jul  7 11:41:47 BST 2019
+/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Jul  7 11:43:37 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 };
 
 /*
@@ -2756,6 +2756,42 @@ static const char* apzDarwin_Gcc4_BreakagePatch[] = {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  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
  */
 tSCC zDarwin_Longjmp_NoreturnName[] =
@@ -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,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 727f7d2..861532c 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -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>';
 };
 
 /*
@@ -1355,6 +1355,22 @@ fix = {
 };
 
 /*
+ * 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.
  */
 fix = {
diff --git a/fixincludes/tests/base/architecture/ppc/math.h b/fixincludes/tests/base/architecture/ppc/math.h
index 4af7808..e7db705 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 */



More information about the Gcc-cvs mailing list