]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
sys_wait-h: Fix compilation error on Solaris 10 in C++ mode.
authorBruno Haible <bruno@clisp.org>
Sun, 10 May 2026 14:29:18 +0000 (16:29 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 10 May 2026 14:29:18 +0000 (16:29 +0200)
* lib/sys_wait.in.h (_GL_INCLUDING_SYS_WAIT_H): New macro, to avoid
recursive include problems.
* modules/sys_wait-h (Makefile.am): Substitute
INCLUDE_NEXT_AS_FIRST_DIRECTIVE, NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H.

ChangeLog
lib/sys_wait.in.h
modules/sys_wait-h

index fa1a0598e6097509324f811fd1ebf712be11ab7f..0e96accffa3d30379761fad4bf267c27ef22d810 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-05-10  Bruno Haible  <bruno@clisp.org>
+
+       sys_wait-h: Fix compilation error on Solaris 10 in C++ mode.
+       * lib/sys_wait.in.h (_GL_INCLUDING_SYS_WAIT_H): New macro, to avoid
+       recursive include problems.
+       * modules/sys_wait-h (Makefile.am): Substitute
+       INCLUDE_NEXT_AS_FIRST_DIRECTIVE, NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H.
+
 2026-05-10  Bruno Haible  <bruno@clisp.org>
 
        strnul: Fix compilation in C++ mode on Solaris 10 with Oracle Studio 12.
index 884c63d84fa7a66d7123128551a34196ccc958fa..8d4145d78264d3a6622a3885b793c960e35638ae 100644 (file)
 #endif
 @PRAGMA_COLUMNS@
 
+#if defined _GL_INCLUDING_SYS_WAIT_H
+/* Special invocation convention:
+   - On Solaris 10 we have a sequence of nested includes
+     <sys/wait.h> -> <stdlib.h> -> <sys/wait.h>
+     In this situation, the functions are not yet declared, therefore we cannot
+     provide the C++ aliases.  */
+
+#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H@
+
+#else
+/* Normal invocation convention.  */
+
 /* The include_next requires a split double-inclusion guard.  */
 #if !(defined _WIN32 && ! defined __CYGWIN__)
+# define _GL_INCLUDING_SYS_WAIT_H
 # @INCLUDE_NEXT@ @NEXT_SYS_WAIT_H@
+# undef _GL_INCLUDING_SYS_WAIT_H
 #endif
 
 #ifndef _@GUARD_PREFIX@_SYS_WAIT_H
@@ -132,4 +146,5 @@ _GL_WARN_ON_USE (waitpid, "waitpid is unportable - "
 
 
 #endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
+#endif /* _GL_INCLUDING_SYS_WAIT_H */
 #endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
index 455cf961fba0d4500699716d1e8f9e5e7454deca..d995b1aedb2f54abdbc7cb34d50abcc7c15e7555 100644 (file)
@@ -26,9 +26,11 @@ sys/wait.h: sys_wait.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U
        $(AM_V_GEN)$(MKDIR_P) '%reldir%/sys'
        $(AM_V_at)$(SED_HEADER_STDOUT) \
              -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+             -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H''@|$(NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H)|g' \
              -e 's|@''NEXT_SYS_WAIT_H''@|$(NEXT_SYS_WAIT_H)|g' \
              -e 's/@''GNULIB_WAITPID''@/$(GNULIB_WAITPID)/g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \