diff mbox series

[Darwin,fixincludes,comitted] Fix Darwin14 header issues.

Message ID BC8502E8-A5A6-48DC-B053-0577F401EA3D@sandoe.co.uk
State New
Headers show
Series [Darwin,fixincludes,comitted] Fix Darwin14 header issues. | expand

Commit Message

Iain Sandoe June 21, 2019, 7:30 p.m. UTC
There are two issues with the Darwin14 (SDK) headers in which unguarded
advanced syntax elements causes any code including these headers to fail.

tested on several Darwin versions and x86-64-linux-gnu.
applied to mainline,
thanks
Iain

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.
diff mbox series

Patch

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 3900d15927..727f7d2cb2 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -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?

diff --git a/fixincludes/tests/base/dispatch/object.h b/fixincludes/tests/base/dispatch/object.h
new file mode 100644
index 0000000000..36722f4b9d
--- /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 0000000000..44aa3932cf
--- /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 */
diff --git a/gcc/REVISION b/gcc/REVISION
index a2dcc4d5f8..ec88b2c51c 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@ 
-[trunk revision 272560]
+[trunk revision 272561]