From 4f3b1a09d3109f03299a2ac15cfa3059596fcb1d Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sat, 1 Jan 2022 12:22:00 +0100 Subject: [PATCH] Fixincludes: Handle __FLT_EVAL_METHOD__ == 16 on darwin 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 | 53 +++++++++++++++++++++++++++++++---- fixincludes/inclhack.def | 11 ++++++++ fixincludes/tests/base/math.h | 5 ++++ 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index bc2fcd22482..cb83f012a2f 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 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. * @@ -3564,6 +3564,43 @@ static const char* apzDarwin_Ucred__AtomicPatch[] = { #endif\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * 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 @@ -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, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 46e3b8c993a..e2987c9c2ff 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -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 on Digital UNIX V4.0: * It contains a prototype for a DEC C internal asm() function, diff --git a/fixincludes/tests/base/math.h b/fixincludes/tests/base/math.h index c7da15ad2c7..58f695f9adf 100644 --- a/fixincludes/tests/base/math.h +++ b/fixincludes/tests/base/math.h @@ -30,6 +30,11 @@ #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 */