[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 <iain@sandoe.co.uk> * 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
This commit is contained in:
parent
8d5558c518
commit
59a0b1db75
5 changed files with 187 additions and 5 deletions
|
@ -1,3 +1,12 @@
|
|||
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.
|
||||
* fixincl.x: Regenerate.
|
||||
* tests/base/dispatch/object.h: New file.
|
||||
* tests/base/os/base.h: New file.
|
||||
|
||||
2019-05-11 Iain Sandoe <iain@sandoe.co.uk>
|
||||
PR target/90379
|
||||
PR bootstrap/89864
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1425,6 +1425,49 @@ fix = {
|
|||
_EOText_;
|
||||
};
|
||||
|
||||
/*
|
||||
* In macOS 10.10 <os/base.h>, 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 <dispatch/object.h>, 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?
|
||||
|
|
18
fixincludes/tests/base/dispatch/object.h
Normal file
18
fixincludes/tests/base/dispatch/object.h
Normal file
|
@ -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 */
|
20
fixincludes/tests/base/os/base.h
Normal file
20
fixincludes/tests/base/os/base.h
Normal file
|
@ -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 */
|
Loading…
Add table
Reference in a new issue