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

Reply via email to