From: Bruno Haible Date: Mon, 9 Dec 2019 02:02:08 +0000 (+0100) Subject: Fix compilation errors in C++ mode on Haiku. X-Git-Tag: v1.0~4536 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=253f29d8b391ebe8cea50355eda351bb7962e160;p=gnulib.git Fix compilation errors in C++ mode on Haiku. * lib/stdio.in.h (vdprintf): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * lib/spawn.in.h (posix_spawnattr_getschedpolicy, posix_spawnattr_setschedpolicy, posix_spawnattr_getschedparam, posix_spawnattr_setschedparam): Likewise. * lib/stdlib.in.h (random, initstate_r, setstate_r): Use _GL_CXXALIAS_SYS_CAST instead of _GL_CXXALIAS_SYS. * lib/unistd.in.h (usleep): Likewise. --- diff --git a/ChangeLog b/ChangeLog index d4ca157cf5..0bbb7249b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2019-12-08 Bruno Haible + + Fix compilation errors in C++ mode on Haiku. + * lib/stdio.in.h (vdprintf): Disable _GL_CXXALIASWARN invocation on + non-glibc systems. + * lib/spawn.in.h (posix_spawnattr_getschedpolicy, + posix_spawnattr_setschedpolicy, posix_spawnattr_getschedparam, + posix_spawnattr_setschedparam): Likewise. + * lib/stdlib.in.h (random, initstate_r, setstate_r): Use + _GL_CXXALIAS_SYS_CAST instead of _GL_CXXALIAS_SYS. + * lib/unistd.in.h (usleep): Likewise. + 2019-12-08 Bruno Haible Fix compilation errors in 32-bit C++ mode on HP-UX 11/ia64. diff --git a/lib/spawn.in.h b/lib/spawn.in.h index 09c66f5adc..c4e1f134b8 100644 --- a/lib/spawn.in.h +++ b/lib/spawn.in.h @@ -604,7 +604,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int, (const posix_spawnattr_t *_Restrict_ __attr, int *_Restrict_ __schedpolicy)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_getschedpolicy # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY @@ -634,7 +636,9 @@ _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int, _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int, (posix_spawnattr_t *__attr, int __schedpolicy)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_setschedpolicy # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY @@ -668,7 +672,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int, (const posix_spawnattr_t *_Restrict_ __attr, struct sched_param *_Restrict_ __schedparam)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_getschedparam); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_getschedparam # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM @@ -702,7 +708,9 @@ _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int, (posix_spawnattr_t *_Restrict_ __attr, const struct sched_param *_Restrict_ __schedparam)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (posix_spawnattr_setschedparam); +# endif #elif defined GNULIB_POSIXCHECK # undef posix_spawnattr_setschedparam # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 4aea52c1a7..447a4723ab 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -1259,7 +1259,9 @@ _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) _GL_CXXALIAS_SYS_CAST (vdprintf, int, (int fd, const char *format, va_list args)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (vdprintf); +# endif #elif defined GNULIB_POSIXCHECK # undef vdprintf # if HAVE_RAW_DECL_VDPRINTF diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 2d02b4b012..5edae2c4ef 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -599,7 +599,9 @@ _GL_CXXALIAS_RPL (random, long, (void)); # if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (random, long, (void)); # endif -_GL_CXXALIAS_SYS (random, long, (void)); +/* Need to cast, because on Haiku, the return type is + int. */ +_GL_CXXALIAS_SYS_CAST (random, long, (void)); # endif _GL_CXXALIASWARN (random); #elif defined GNULIB_POSIXCHECK @@ -766,9 +768,11 @@ _GL_FUNCDECL_SYS (initstate_r, int, struct random_data *rand_state) _GL_ARG_NONNULL ((2, 4))); # endif -_GL_CXXALIAS_SYS (initstate_r, int, - (unsigned int seed, char *buf, size_t buf_size, - struct random_data *rand_state)); +/* Need to cast, because on Haiku, the third parameter is + unsigned long buf_size. */ +_GL_CXXALIAS_SYS_CAST (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); # endif _GL_CXXALIASWARN (initstate_r); #elif defined GNULIB_POSIXCHECK @@ -796,8 +800,10 @@ _GL_FUNCDECL_SYS (setstate_r, int, (char *arg_state, struct random_data *rand_state) _GL_ARG_NONNULL ((1, 2))); # endif -_GL_CXXALIAS_SYS (setstate_r, int, - (char *arg_state, struct random_data *rand_state)); +/* Need to cast, because on Haiku, the first parameter is + void *arg_state. */ +_GL_CXXALIAS_SYS_CAST (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); # endif _GL_CXXALIASWARN (setstate_r); #elif defined GNULIB_POSIXCHECK diff --git a/lib/unistd.in.h b/lib/unistd.in.h index c57d6f9ff3..28ab704c3b 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1677,7 +1677,9 @@ _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); # if !@HAVE_USLEEP@ _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); # endif -_GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); +/* Need to cast, because on Haiku, the first parameter is + unsigned int n. */ +_GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); # endif _GL_CXXALIASWARN (usleep); #elif defined GNULIB_POSIXCHECK