On HP-UX 11.11, I'm observing this compilation error in C++ mode: g++ -DHAVE_CONFIG_H -I. -DGNULIB_STRICT_CHECKING=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -Wall -MT test-fcntl-h-c++.o -MD -MP -MF $depbase.Tpo -c -o test-fcntl-h-c++.o test-fcntl-h-c++.cc In file included from test-fcntl-h-c++.cc:22: ../gllib/fcntl.h:416: error: default argument given for parameter 3 of 'int open(const char*, int, mode_t)' /usr/include/sys/fcntl.h:256: error: after previous specification in 'int open(const char*, int, mode_t)' *** Error exit code 1
The reason is that in this situation, open() is defined as an inline function with a default argument: #if defined(__cplusplus) && defined(_APP32_64BIT_OFF_T) ... inline int open(const char *a, int b, mode_t c=0) ... This patch avoids the error. 2010-12-31 Bruno Haible <[email protected]> open: Avoid C++ error on HP-UX 11. * lib/fcntl.in.h (open): Disable _GL_CXXALIASWARN invocation on HP-UX. --- lib/fcntl.in.h.orig Fri Dec 31 14:16:35 2010 +++ lib/fcntl.in.h Fri Dec 31 14:16:27 2010 @@ -107,7 +107,11 @@ # else _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); # endif +/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a + default argument. _GL_CXXALIASWARN does not work in this case. */ +# if !defined __hpux _GL_CXXALIASWARN (open); +# endif #elif defined GNULIB_POSIXCHECK # undef open /* Assume open is always declared. */
