From: Iain Sandoe Date: Wed, 4 Sep 2019 19:01:49 +0000 (+0000) Subject: [Darwin, fixincludes] Backport fixes Darwin14 header issues. X-Git-Tag: releases/gcc-7.5.0~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28629080f35dd136897291278141cd2b58ee9b70;p=thirdparty%2Fgcc.git [Darwin, fixincludes] Backport fixes 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. This fixes build fails on Darwin14 systems. 2019-09-04 Iain Sandoe Backport from mainline. 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: r275378 --- diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index af533dcf025d..96318b2d4f8e 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,15 @@ +2019-09-04 Iain Sandoe + + Backport from mainline. + 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-06-03 Iain Sandoe Backport from mainline. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index c9173519c081..e95bccdf9fa1 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 30, 2019 at 04:05:59 PM by AutoGen 5.17.4 + * It has been AutoGen-ed August 29, 2019 at 12:20:01 AM by AutoGen 5.17.4 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Thu May 30 16:05:59 BST 2019 +/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Aug 29 00:20:01 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 249 fixup descriptions. + * This file contains 251 fixup descriptions. * * See README for more information. * @@ -2904,6 +2904,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 @@ -10181,9 +10261,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 286 +#define REGEX_COUNT 288 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 249 +#define FIX_COUNT 251 /* * Enumerate the fixes @@ -10256,6 +10336,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, @@ -10776,6 +10858,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 4c3c23883516..7fa3af4e4c85 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1491,6 +1491,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 000000000000..36722f4b9dcd --- /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 000000000000..44aa3932cfaf --- /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 */