On HP-UX 11.00 with gcc, I'm seeing this error: g++ -DHAVE_CONFIG_H -I. -DGNULIB_STRICT_CHECKING=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -Wall -MT test-termios-c++.o -MD -MP -MF $depbase.Tpo -c -o test-termios-c++.o test-termios-c++.cc In file included from test-termios-c++.cc:22: /usr/include/sys/termio.h:290: error: previous declaration of 'pid_t tcgetsid(int)' with 'C++' linkage ../gllib/termios.h:353: error: conflicts with new declaration with 'C' linkage test-termios-c++.cc:28: warning: 'signature_check28' defined but not used *** Error exit code 1
The reason is that /usr/include/sys/termio.h is lacking an 'extern "C"' specifier for the tcgetsid declaration. This patch provides a workaround. 2011-01-02 Bruno Haible <br...@clisp.org> tcgetsid: Correct linkage in C++ mode on HP-UX 11.00. * lib/termios.in.h: In C++ mode, on HP-UX, include <sys/termios.h> with C linkage. * doc/posix-functions/tcgetsid.texi: Mention the HP-UX 11.00 bug. --- doc/posix-functions/tcgetsid.texi.orig Sun Jan 2 13:26:23 2011 +++ doc/posix-functions/tcgetsid.texi Sun Jan 2 13:25:43 2011 @@ -14,6 +14,10 @@ @item This function is not declared on some platforms: OSF/1 5.1. +...@item +The declaration of this function in C++ compilation units has C++ linkage, not +C linkage, on some platforms: +HP-UX 11.00. @end itemize Portability problems not fixed by Gnulib: --- lib/termios.in.h.orig Sun Jan 2 13:26:23 2011 +++ lib/termios.in.h Sun Jan 2 13:18:54 2011 @@ -22,6 +22,17 @@ #endif @PRAGMA_COLUMNS@ +/* On HP-UX 11.00, some of the function declarations in <sys/termio.h>, + included by <termios.h>, are not protected by extern "C". Enforce + "C" linkage for these functions nevertheless. */ +#if defined __hpux && defined __cplusplus +# include <sys/types.h> +# include <sys/ioctl.h> +extern "C" { +# include <sys/termio.h> +} +#endif + /* The include_next requires a split double-inclusion guard. */ #if @HAVE_TERMIOS_H@ # @INCLUDE_NEXT@ @NEXT_TERMIOS_H@