public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [fixincludes] Fix posix_spawn* declarations in Solaris <spawn.h> (PR c++/49347)
@ 2011-07-25 15:49 Rainer Orth
  2011-07-25 16:30 ` Bruce Korb
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Orth @ 2011-07-25 15:49 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bruce Korb

As discussed in the PR, the Solaris 10+ <spawn.h> header needs a fix to
make it work with g++.  The following patch implements it.

It passed a i386-pc-solaris2.11 bootstrap without regressions and make
check in fixincludes works without failures.

Ok for mainline?

Thanks.
	Rainer


diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -3706,6 +3706,23 @@ fix = {
 
 
 /*
+ * Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the
+ * posix_spawn declarations, which doesn't work with C++.
+ */
+fix = {
+    hackname  = solaris_posix_spawn_restrict;
+    files     = spawn.h;
+    mach      = '*-*-solaris2*';
+    c_fix     = format;
+    c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
+    select    = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
+    test_text =
+    "char *const argv[_RESTRICT_KYWD],\n"
+    "char *const envp[_RESTRICT_KYWD]);";
+};
+
+
+/*
  * Sun Solaris 8 has what appears to be some gross workaround for
  * some old version of their c++ compiler.  G++ doesn't want it
  * either, but doesn't want to be tied to SunPRO version numbers.
diff --git a/fixincludes/tests/base/spawn.h b/fixincludes/tests/base/spawn.h
new file mode 100644
--- /dev/null
+++ b/fixincludes/tests/base/spawn.h
@@ -0,0 +1,15 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/spawn.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( SOLARIS_POSIX_SPAWN_RESTRICT_CHECK )
+char *const *_RESTRICT_KYWD argv,
+char *const *_RESTRICT_KYWD envp);
+#endif  /* SOLARIS_POSIX_SPAWN_RESTRICT_CHECK */

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

* Re: [fixincludes] Fix posix_spawn* declarations in Solaris <spawn.h> (PR c++/49347)
  2011-07-25 15:49 [fixincludes] Fix posix_spawn* declarations in Solaris <spawn.h> (PR c++/49347) Rainer Orth
@ 2011-07-25 16:30 ` Bruce Korb
  2011-07-25 16:41   ` Rainer Orth
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Korb @ 2011-07-25 16:30 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

On 07/25/11 08:17, Rainer Orth wrote:
> As discussed in the PR, the Solaris 10+<spawn.h>  header needs a fix to
> make it work with g++.  The following patch implements it.
>
> It passed a i386-pc-solaris2.11 bootstrap without regressions and make
> check in fixincludes works without failures.
>
> Ok for mainline?

Hi Rainer,

 > some-function(char *const argv[_RESTRICT_KYWD], ...)

looks pretty broken to me.  How would it work with plain gcc?
Anyway, editing the _RESTRICT_KYWD into the correct place looks
correct to me, and I'm sure you tested.  "Ship it".  Methinks
all active branches, too....

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

* Re: [fixincludes] Fix posix_spawn* declarations in Solaris <spawn.h> (PR c++/49347)
  2011-07-25 16:30 ` Bruce Korb
@ 2011-07-25 16:41   ` Rainer Orth
  0 siblings, 0 replies; 3+ messages in thread
From: Rainer Orth @ 2011-07-25 16:41 UTC (permalink / raw)
  To: bkorb; +Cc: gcc-patches

Hi Bruce,

>> some-function(char *const argv[_RESTRICT_KYWD], ...)
>
> looks pretty broken to me.  How would it work with plain gcc?

no idea, but both gcc -std=c99 and Sun Studio cc -xc99 do accept it.

> Anyway, editing the _RESTRICT_KYWD into the correct place looks
> correct to me, and I'm sure you tested.  "Ship it".  Methinks
> all active branches, too....

I'll restrict it to mainline and the 4.6 branch since this is the first
one that had the fix for

#define        _RESTRICT_KYWD  __restrict

in <sys/feature_tests.h>.

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

end of thread, other threads:[~2011-07-25 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25 15:49 [fixincludes] Fix posix_spawn* declarations in Solaris <spawn.h> (PR c++/49347) Rainer Orth
2011-07-25 16:30 ` Bruce Korb
2011-07-25 16:41   ` Rainer Orth

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).