[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fix compilation errors in C++ mode on Haiku
From: |
Bruno Haible |
Subject: |
fix compilation errors in C++ mode on Haiku |
Date: |
Mon, 09 Dec 2019 03:02:46 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; ) |
On Haiku, a testdir built with --with-c++-tests produces the following errors:
../gllib/stdio.h:1736:1: error: 'vdprintf' was not declared in this scope
_GL_CXXALIASWARN (vdprintf);
^
../gllib/unistd.h: In member function 'gnulib::_gl_usleep_wrapper::operator
gnulib::_gl_usleep_wrapper::type() const':
../gllib/unistd.h:2154:1: error: invalid conversion from 'int (*)(unsigned
int)' to 'gnulib::_gl_usleep_wrapper::type {aka int (*)(long unsigned int)}'
[-fpermissive]
_GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
^
../gllib/stdlib.h: In member function 'gnulib::_gl_random_wrapper::operator
gnulib::_gl_random_wrapper::type() const':
../gllib/stdlib.h:1116:1: error: invalid conversion from 'int (*)()' to
'gnulib::_gl_random_wrapper::type {aka long int (*)()}' [-fpermissive]
_GL_CXXALIAS_SYS (random, long, (void));
^
../gllib/stdlib.h: In member function
'gnulib::_gl_initstate_r_wrapper::operator
gnulib::_gl_initstate_r_wrapper::type() const':
../gllib/stdlib.h:1283:1: error: invalid conversion from 'int (*)(unsigned int,
void*, size_t, random_data*) {aka int (*)(unsigned int, void*, long unsigned
int, random_data*)}' to 'gnulib::_gl_initstate_r_wrapper::type {aka int
(*)(unsigned int, char*, long unsigned int, random_data*)}' [-fpermissive]
_GL_CXXALIAS_SYS (initstate_r, int,
^
../gllib/stdlib.h: In member function 'gnulib::_gl_setstate_r_wrapper::operator
gnulib::_gl_setstate_r_wrapper::type() const':
../gllib/stdlib.h:1313:1: error: invalid conversion from 'int (*)(void*,
random_data*)' to 'gnulib::_gl_setstate_r_wrapper::type {aka int (*)(char*,
random_data*)}' [-fpermissive]
_GL_CXXALIAS_SYS (setstate_r, int,
^
../gllib/spawn.h:1081:1: error: 'posix_spawnattr_getschedpolicy' was not
declared in this scope
_GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
^
../gllib/spawn.h:1111:1: error: 'posix_spawnattr_setschedpolicy' was not
declared in this scope
_GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
^
../gllib/spawn.h:1145:1: error: 'posix_spawnattr_getschedparam' was not
declared in this scope
_GL_CXXALIASWARN (posix_spawnattr_getschedparam);
^
../gllib/spawn.h:1179:1: error: 'posix_spawnattr_setschedparam' was not
declared in this scope
_GL_CXXALIASWARN (posix_spawnattr_setschedparam);
^
This patch fixes it.
2019-12-08 Bruno Haible <address@hidden>
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/lib/spawn.in.h b/lib/spawn.in.h
index 09c66f5..c4e1f13 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 4aea52c..447a472 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 2d02b4b..5edae2c 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 c57d6f9..28ab704 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- fix compilation errors in C++ mode on Haiku,
Bruno Haible <=