public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Darwin] Fix PR bootstrap/89864
@ 2019-04-16  7:39 Iain Sandoe
  2019-04-16 15:36 ` Mike Stump
  0 siblings, 1 reply; 3+ messages in thread
From: Iain Sandoe @ 2019-04-16  7:39 UTC (permalink / raw)
  To: GCC Patches; +Cc: Mike Stump

Hi,

TL;DR
So, it turns out that there’s an interaction between standards wording that makes an implementation conforming when it has extensions that, when used, make a program ill-formed (but with no diagnostic required) (see the PR for more detail).

One might argue that using such extensions is asking for portability issues (the case here), but it’s not prohibited.

The following patch applies a fixincludes to work around it for now, I’ve tested it DTRT for me and posted to the PR for other folks to confirm it works for them.

OK for trunk (after wider testing)?
branches?

Iain

fixincludes/
xxxx-xx-xx  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.
	
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 8fd9f7e..d8ce89a 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -1622,6 +1622,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";
+};
+
 /*
  *  Fix <c_asm.h> on Digital UNIX V4.0:
  *  It contains a prototype for a DEC C internal asm() function,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch, Darwin] Fix PR bootstrap/89864
  2019-04-16  7:39 [Patch, Darwin] Fix PR bootstrap/89864 Iain Sandoe
@ 2019-04-16 15:36 ` Mike Stump
  2019-04-16 16:47   ` Iain Sandoe
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Stump @ 2019-04-16 15:36 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Patches



> On Apr 15, 2019, at 11:59 PM, Iain Sandoe <idsandoe@googlemail.com> wrote:
> OK for trunk (after wider testing)?

Didn't we make you a Darwin maintainer yet?

Ok.

> branches?

Ok.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch, Darwin] Fix PR bootstrap/89864
  2019-04-16 15:36 ` Mike Stump
@ 2019-04-16 16:47   ` Iain Sandoe
  0 siblings, 0 replies; 3+ messages in thread
From: Iain Sandoe @ 2019-04-16 16:47 UTC (permalink / raw)
  To: Mike Stump; +Cc: GCC Patches

Hi Mike,

> On 16 Apr 2019, at 21:05, Mike Stump <mikestump@comcast.net> wrote:
> 
>> On Apr 15, 2019, at 11:59 PM, Iain Sandoe <idsandoe@googlemail.com> wrote:
>> OK for trunk (after wider testing)?
> 
> Didn't we make you a Darwin maintainer yet?

/me is willing .. (given the usual comment about finite time available, of course)

> Ok.
> 
>> branches?
> 
> Ok.

thanks,
Iain


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-16 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16  7:39 [Patch, Darwin] Fix PR bootstrap/89864 Iain Sandoe
2019-04-16 15:36 ` Mike Stump
2019-04-16 16:47   ` Iain Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).