Fixincludes: Handle __FLT_EVAL_METHOD__ == 16 on darwin
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sat, 1 Jan 2022 11:22:00 +0000 (12:22 +0100)
committerFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sat, 1 Jan 2022 12:00:41 +0000 (13:00 +0100)
The darwin system headers error out on __FLT_EVAL_METHOD__ == 16, which
occurs when the compiler is called with -mavx512fp16 on i386. Allow this
value to proceed past the check (nothing else depends on it in the
system headers).

fixincludes/ChangeLog:

* inclhack.def: Add new fix on darwin.
* fixincl.x: Regenerate.
* tests/base/math.h: Regenerate.

fixincludes/fixincl.x
fixincludes/inclhack.def
fixincludes/tests/base/math.h

index bc2fcd2..cb83f01 100644 (file)
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  August 30, 2021 at 07:31:11 PM by AutoGen 5.18.16
+ * It has been AutoGen-ed  January  1, 2022 at 11:58:02 AM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Mon Aug 30 19:31:11 UTC 2021
+/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jan  1 11:58:02 CET 2022
  *
  * 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 261 fixup descriptions.
+ * This file contains 262 fixup descriptions.
  *
  * See README for more information.
  *
@@ -3566,6 +3566,43 @@ static const char* apzDarwin_Ucred__AtomicPatch[] = {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Darwin_Flt_Eval_Method fix
+ */
+tSCC zDarwin_Flt_Eval_MethodName[] =
+     "darwin_flt_eval_method";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zDarwin_Flt_Eval_MethodList[] =
+  "math.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzDarwin_Flt_Eval_MethodMachs[] = {
+        "*-*-darwin*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zDarwin_Flt_Eval_MethodSelect0[] =
+       "^#if __FLT_EVAL_METHOD__ == 0$";
+
+#define    DARWIN_FLT_EVAL_METHOD_TEST_CT  1
+static tTestDesc aDarwin_Flt_Eval_MethodTests[] = {
+  { TT_EGREP,    zDarwin_Flt_Eval_MethodSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Darwin_Flt_Eval_Method
+ */
+static const char* apzDarwin_Flt_Eval_MethodPatch[] = {
+    "format",
+    "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Dec_Intern_Asm fix
  */
 tSCC zDec_Intern_AsmName[] =
@@ -10612,9 +10649,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          299
+#define REGEX_COUNT          300
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            261
+#define FIX_COUNT            262
 
 /*
  *  Enumerate the fixes
@@ -10704,6 +10741,7 @@ typedef enum {
     DARWIN_STDINT_6_FIXIDX,
     DARWIN_STDINT_7_FIXIDX,
     DARWIN_UCRED__ATOMIC_FIXIDX,
+    DARWIN_FLT_EVAL_METHOD_FIXIDX,
     DEC_INTERN_ASM_FIXIDX,
     DJGPP_WCHAR_H_FIXIDX,
     ECD_CURSOR_FIXIDX,
@@ -11304,6 +11342,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      DARWIN_UCRED__ATOMIC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aDarwin_Ucred__AtomicTests,   apzDarwin_Ucred__AtomicPatch, 0 },
 
+  {  zDarwin_Flt_Eval_MethodName,    zDarwin_Flt_Eval_MethodList,
+     apzDarwin_Flt_Eval_MethodMachs,
+     DARWIN_FLT_EVAL_METHOD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aDarwin_Flt_Eval_MethodTests,   apzDarwin_Flt_Eval_MethodPatch, 0 },
+
   {  zDec_Intern_AsmName,    zDec_Intern_AsmList,
      apzDec_Intern_AsmMachs,
      DEC_INTERN_ASM_TEST_CT, FD_MACH_ONLY,
index 46e3b8c..e2987c9 100644 (file)
@@ -1767,6 +1767,17 @@ fix = {
     test_text = ""; /* Don't provide this for wrap fixes.  */
 };
 
+/*  The darwin headers don't accept __FLT_EVAL_METHOD__ == 16.  */
+fix = {
+    hackname  = darwin_flt_eval_method;
+    mach      = "*-*-darwin*";
+    files     = math.h;
+    select    = "^#if __FLT_EVAL_METHOD__ == 0$";
+    c_fix     = format;
+    c_fix_arg = "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16";
+    test_text = "#if __FLT_EVAL_METHOD__ == 0";
+};
+
 /*
  *  Fix <c_asm.h> on Digital UNIX V4.0:
  *  It contains a prototype for a DEC C internal asm() function,
index c7da15a..58f695f 100644 (file)
 #endif  /* DARWIN_9_LONG_DOUBLE_FUNCS_2_CHECK */
 
 
+#if defined( DARWIN_FLT_EVAL_METHOD_CHECK )
+#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16
+#endif  /* DARWIN_FLT_EVAL_METHOD_CHECK */
+
+
 #if defined( HPPA_HPUX_FP_MACROS_CHECK )
 #endif /* _INCLUDE_HPUX_SOURCE */