-From 235ccac0aeb941c860c1e469a645ab9a90c9eca2 Mon Sep 17 00:00:00 2001
-From: Iain Sandoe <iain@sandoe.co.uk>
-Date: Thu, 18 Apr 2019 21:20:09 +0530
-Subject: [PATCH] backport r270435 - fix PR89864
 
-	Backport from mainline
-	2019-04-18  Erik Schnetter  <schnetter@gmail.com>
-          Jakub Jelinek  <jakub@redhat.com>
-          Iain Sandoe  <iain@sandoe.co.uk>
-
-        PR bootstrap/89864
-        * inclhack.def (darwin_ucred__Atomic): New, work around _Atomic keyword
-        use in headers included by C++.
-        * fixincl.x: Regenerated.
----
- fixincludes/fixincl.x    | 58 ++++++++++++++++++++++++++++++++++++----
- fixincludes/inclhack.def | 19 +++++++++++++
- 2 files changed, 72 insertions(+), 5 deletions(-)
-
-diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
-index 1a1f46c0518..1fff079f60d 100644
---- a/fixincludes/fixincl.x
-+++ b/fixincludes/fixincl.x
-@@ -2,11 +2,11 @@
+diff -r -u gcc-8.3.0/fixincludes/fixincl.x gcc-8.3.0-patch/fixincludes/fixincl.x
+--- gcc-8.3.0/fixincludes/fixincl.x	2018-02-23 01:12:26.000000000 +0900
++++ gcc-8.3.0-patch/fixincludes/fixincl.x	2019-04-11 12:37:25.000000000 +0900
+@@ -3222,6 +3222,44 @@
+ 
+ /* * * * * * * * * * * * * * * * * * * * * * * * * *
   *
-  * DO NOT EDIT THIS FILE   (fixincl.x)
-  *
-- * It has been AutoGen-ed  April 13, 2019 at 09:58:23 AM by AutoGen 5.17.4
-+ * It has been AutoGen-ed  April 18, 2019 at 10:07:54 AM by AutoGen 5.17.4
-  * From the definitions    inclhack.def
-  * and the template file   fixincl
-  */
--/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Apr 13 09:58:23 IST 2019
-+/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Apr 18 10:07:54 IST 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 251 fixup descriptions.
-+ * This file contains 252 fixup descriptions.
-  *
-  * See README for more information.
-  *
-@@ -3300,6 +3300,48 @@ static const char* apzDarwin_Stdint_7Patch[] = {
- #endif",
-     (char*)NULL };
- 
-+/* * * * * * * * * * * * * * * * * * * * * * * * * *
-+ *
 + *  Description of Darwin_Ucred__Atomic fix
 + */
 +tSCC zDarwin_Ucred__AtomicName[] =

   {  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 7f0fb9dc911..49ba499ecde 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -1635,6 +1635,25 @@ fix = {
 		"#define UINTMAX_C(v) (v ## ULL)";
 };
 
+/*  The SDK included with XCode 10.2 has the file <sys/ucred.h> that uses the
+    C11 _Atomic keyword (exposing it to C++ code).  The work-around here follows
+    the header in declaring the entity volatile when _Atomic is not available.
+*/
+fix = {
+    hackname  = darwin_ucred__Atomic;
+    mach      = "*-*-darwin*";
+    files     = sys/ucred.h;
+    select    = "_Atomic";
+    c_fix     = wrap;
+    c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n"
+		"# define _Atomic volatile\n"
+		"#endif\n";
+    c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n"
+		"# undef _Atomic\n"
+		"#endif\n";
+    test_text = "_Atomic";
+};
+

     DEC_INTERN_ASM_FIXIDX,
     DJGPP_WCHAR_H_FIXIDX,
     ECD_CURSOR_FIXIDX,
@@ -10739,6 +10778,11 @@
      DARWIN_STDINT_7_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aDarwin_Stdint_7Tests,   apzDarwin_Stdint_7Patch, 0 },
 
