From: Iain Sandoe Date: Fri, 21 Jun 2019 19:03:45 +0000 (+0000) Subject: [Darwin, fixincludes] Fix Darwin14 header issues. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=59a0b1db756fc17b952c8423b015154a7bd23d10;p=gcc.git [Darwin, fixincludes] Fix Darwin14 header issues. There are two issues with the Darwin14 (SDK) headers in which unguarded advanced syntax elements causes any code including these headers to fail. 2019-06-21 Iain Sandoe * inclhack.def: Guard __has_attribute and __has_extension in os/base.h. Guard Apple blocks syntax in dispatch/object.h. * fixincl.x: Regenerate. * tests/base/dispatch/object.h: New file. * tests/base/os/base.h: New file. From-SVN: r272561 --- diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 9d59d18fc6a..49135f038a0 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,12 @@ +2019-06-21 Iain Sandoe + + * inclhack.def: Guard __has_attribute and __has_extension in + os/base.h. + Guard Apple blocks syntax in dispatch/object.h. + * fixincl.x: Regenerate. + * tests/base/dispatch/object.h: New file. + * tests/base/os/base.h: New file. + 2019-05-11 Iain Sandoe PR target/90379 PR bootstrap/89864 diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 48fc25807a2..7b505845bda 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 May 11, 2019 at 03:09:50 PM by AutoGen 5.17.4 + * It has been AutoGen-ed May 13, 2019 at 04:17:28 PM by AutoGen 5.17.4 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat May 11 15:09:50 BST 2019 +/* DO NOT SVN-MERGE THIS FILE, EITHER Mon May 13 16:17:28 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 252 fixup descriptions. + * This file contains 254 fixup descriptions. * * See README for more information. * @@ -2916,6 +2916,86 @@ static const char* apzDarwin_Os_Trace_3Patch[] = { #endif", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Os_Base_1 fix + */ +tSCC zDarwin_Os_Base_1Name[] = + "darwin_os_base_1"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Os_Base_1List[] = + "os/base.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Os_Base_1Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Os_Base_1Select0[] = + "#define __has_attribute.*\n\ +#endif"; + +#define DARWIN_OS_BASE_1_TEST_CT 1 +static tTestDesc aDarwin_Os_Base_1Tests[] = { + { TT_EGREP, zDarwin_Os_Base_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Os_Base_1 + */ +static const char* apzDarwin_Os_Base_1Patch[] = { + "format", + "%0\n\ +#ifndef __has_extension\n\ +#define __has_extension(x) 0\n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Dispatch_Object_1 fix + */ +tSCC zDarwin_Dispatch_Object_1Name[] = + "darwin_dispatch_object_1"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Dispatch_Object_1List[] = + "dispatch/object.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Dispatch_Object_1Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Dispatch_Object_1Select0[] = + "typedef void.*\\^dispatch_block_t.*"; + +#define DARWIN_DISPATCH_OBJECT_1_TEST_CT 1 +static tTestDesc aDarwin_Dispatch_Object_1Tests[] = { + { TT_EGREP, zDarwin_Dispatch_Object_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Dispatch_Object_1 + */ +static const char* apzDarwin_Dispatch_Object_1Patch[] = { + "format", + "#if __BLOCKS__\n\ +%0\n\ +#endif", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Darwin_Private_Extern fix @@ -10230,9 +10310,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 290 +#define REGEX_COUNT 292 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 252 +#define FIX_COUNT 254 /* * Enumerate the fixes @@ -10307,6 +10387,8 @@ typedef enum { DARWIN_OS_TRACE_1_FIXIDX, DARWIN_OS_TRACE_2_FIXIDX, DARWIN_OS_TRACE_3_FIXIDX, + DARWIN_OS_BASE_1_FIXIDX, + DARWIN_DISPATCH_OBJECT_1_FIXIDX, DARWIN_PRIVATE_EXTERN_FIXIDX, DARWIN_STDINT_1_FIXIDX, DARWIN_STDINT_2_FIXIDX, @@ -10838,6 +10920,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = { DARWIN_OS_TRACE_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aDarwin_Os_Trace_3Tests, apzDarwin_Os_Trace_3Patch, 0 }, + { zDarwin_Os_Base_1Name, zDarwin_Os_Base_1List, + apzDarwin_Os_Base_1Machs, + DARWIN_OS_BASE_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Os_Base_1Tests, apzDarwin_Os_Base_1Patch, 0 }, + + { zDarwin_Dispatch_Object_1Name, zDarwin_Dispatch_Object_1List, + apzDarwin_Dispatch_Object_1Machs, + DARWIN_DISPATCH_OBJECT_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Dispatch_Object_1Tests, apzDarwin_Dispatch_Object_1Patch, 0 }, + { zDarwin_Private_ExternName, zDarwin_Private_ExternList, apzDarwin_Private_ExternMachs, DARWIN_PRIVATE_EXTERN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 3900d159273..727f7d2cb28 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1425,6 +1425,49 @@ fix = { _EOText_; }; +/* + * In macOS 10.10 , doesn't have __has_extension guarded. + */ +fix = { + hackname = darwin_os_base_1; + mach = "*-*-darwin*"; + files = os/base.h; + select = <<- OS_BASE_1_SEL +#define __has_attribute.* +#endif +OS_BASE_1_SEL; + c_fix = format; + c_fix_arg = <<- OS_BASE_1_FIX +%0 +#ifndef __has_extension +#define __has_extension(x) 0 +#endif +OS_BASE_1_FIX; + test_text = <<- OS_BASE_1_TEST +#define __has_attribute(x) 0 +#endif + +#if __GNUC__ +OS_BASE_1_TEST; +}; + +/* + * In macOS 10.10 , has unguarded block syntax. + */ +fix = { + hackname = darwin_dispatch_object_1; + mach = "*-*-darwin*"; + files = dispatch/object.h; + select = "typedef void.*\\^dispatch_block_t.*"; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = <<- DISPATCH_OBJECT_1_TEST +typedef void (^dispatch_block_t)(void); + +__BEGIN_DECLS +DISPATCH_OBJECT_1_TEST; +}; + /* * __private_extern__ doesn't exist in FSF GCC. Even if it did, * why would you ever put it in a system header file? diff --git a/fixincludes/tests/base/dispatch/object.h b/fixincludes/tests/base/dispatch/object.h new file mode 100644 index 00000000000..36722f4b9dc --- /dev/null +++ b/fixincludes/tests/base/dispatch/object.h @@ -0,0 +1,18 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/dispatch/object.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_DISPATCH_OBJECT_1_CHECK ) +#if __BLOCKS__ +typedef void (^dispatch_block_t)(void); +#endif + +__BEGIN_DECLS +#endif /* DARWIN_DISPATCH_OBJECT_1_CHECK */ diff --git a/fixincludes/tests/base/os/base.h b/fixincludes/tests/base/os/base.h new file mode 100644 index 00000000000..44aa3932cfa --- /dev/null +++ b/fixincludes/tests/base/os/base.h @@ -0,0 +1,20 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/os/base.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_OS_BASE_1_CHECK ) +#define __has_attribute(x) 0 +#endif +#ifndef __has_extension +#define __has_extension(x) 0 +#endif + +#if __GNUC__ +#endif /* DARWIN_OS_BASE_1_CHECK */