bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Compile error with GNULIB_NAMESPACE on Solaris (stdio.h)
@ 2019-11-19 19:57 Christian Biesinger
  2019-11-21 10:53 ` Bruno Haible
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Biesinger @ 2019-11-19 19:57 UTC (permalink / raw)
  To: bug-gnulib

Hi all!

I got a compile error with Gnulib on Solaris 11 / gcc:

$ cat test.cc
#define GNULIB_NAMESPACE gnulib
#include "gnulib/config.h"
#include "stdio.h"

$ g++ test.cc -I gnulib/import/ -I ../gnulib/import/
gnulib/import/stdio.h:1717:1: error: ‘int vfprintf(std::FILE*, const
char*, __va_list)’ conflicts with a previous declaration
 _GL_CXXALIASWARN (vfprintf);
 ^
In file included from
/opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/include-fixed/stdio.h:75:0,
                 from gnulib/import/stdio.h:43,
                 from test.cc:3:
/opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/include-fixed/iso/stdio_iso.h:223:12:
note: previous declaration ‘int std::vfprintf(std::FILE*, const char*,
__va_list)’
 extern int vfprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
            ^
In file included from /usr/include/sys/time.h:480:0,
                 from gnulib/import/sys/time.h:39,
                 from /usr/include/sys/select.h:28,
                 from /usr/include/sys/types.h:664,
                 from gnulib/import/sys/types.h:39,
                 from gnulib/import/stdio.h:58,
                 from test.cc:3:

And lots of other functions.

I'm not sure which module is responsible for this but this is the list
I'm importing:
IMPORTED_GNULIB_MODULES="\
    alloca \
    canonicalize-lgpl \
    dirent \
    dirfd \
    errno \
    fnmatch-gnu \
    frexpl \
    getcwd \
    glob \
    inet_ntop
    inttypes \
    lstat \
    limits-h \
    memchr \
    memmem \
    mkdir \
    mkdtemp \
    mkostemp \
    pathmax \
    rawmemchr \
    readlink \
    rename \
    setenv \
    signal-h \
    strchrnul \
    strerror_r-posix \
    strstr \
    strtok_r \
    sys_stat \
    time_r \
    unistd \
    unsetenv \
    update-copyright \
    wchar \
    wctype-h

Any ideas?
Christian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compile error with GNULIB_NAMESPACE on Solaris (stdio.h)
  2019-11-19 19:57 Compile error with GNULIB_NAMESPACE on Solaris (stdio.h) Christian Biesinger
@ 2019-11-21 10:53 ` Bruno Haible
  2019-11-21 22:41   ` Christian Biesinger
  2019-12-04  3:53   ` Bruno Haible
  0 siblings, 2 replies; 4+ messages in thread
From: Bruno Haible @ 2019-11-21 10:53 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Christian Biesinger

[-- Attachment #1: Type: text/plain, Size: 5080 bytes --]

Hi Christian,

> I got a compile error with Gnulib on Solaris 11 / gcc:
> 
> $ cat test.cc
> #define GNULIB_NAMESPACE gnulib
> #include "gnulib/config.h"
> #include "stdio.h"
> 
> $ g++ test.cc -I gnulib/import/ -I ../gnulib/import/
> gnulib/import/stdio.h:1717:1: error: ‘int vfprintf(std::FILE*, const
> char*, __va_list)’ conflicts with a previous declaration
>  _GL_CXXALIASWARN (vfprintf);
>  ^
> In file included from
> /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/include-fixed/stdio.h:75:0,
>                  from gnulib/import/stdio.h:43,
>                  from test.cc:3:
> /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/include-fixed/iso/stdio_iso.h:223:12:
> note: previous declaration ‘int std::vfprintf(std::FILE*, const char*,
> __va_list)’
>  extern int vfprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
>             ^
> In file included from /usr/include/sys/time.h:480:0,
>                  from gnulib/import/sys/time.h:39,
>                  from /usr/include/sys/select.h:28,
>                  from /usr/include/sys/types.h:664,
>                  from gnulib/import/sys/types.h:39,
>                  from gnulib/import/stdio.h:58,
>                  from test.cc:3:
> 
> And lots of other functions.

This should be fixed by the attached patches.

To investigate this,
- I created a testdir
  $ ./gnulib-tool --create-testdir --dir=/tmp/testdir --single-configure --with-c++-tests `./posix-modules`
- built it,
- ran
  $ make -k
- ran
  $ make -k 2>&1 | tee log4
and collected the resulting log files on various platforms.

A consequence of these patches is that _GL_CXXALIASWARN can only work
reliably on glibc platforms. On other platforms, I had to disable it
on 112 functions.


2019-11-21  Bruno Haible  <bruno@clisp.org>

	pthread-mutex: Fix errors in C++ mode.
	* m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Test whether
	pthread_mutexattr_getrobust exists. If not, define
	PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
	* lib/pthread-mutex.c (pthread_mutexattr_getrobust,
	pthread_mutexattr_setrobust): Define also if <pthread.h> exists but
	PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
	* modules/pthread-mutex (configure.ac): Compile pthread-mutex.c also
	when <pthread.h> exists but pthread_mutexattr_getrobust needs a gnulib
	definition.

2019-11-21  Bruno Haible  <bruno@clisp.org>

	pthread-spin: Fix errors in C++ mode.
	* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Mark the pthread_spin_*
	functions as nonexistent when <pthread.h> exists but does not define
	the pthread_spinlock_t type.

2019-11-21  Bruno Haible  <bruno@clisp.org>

	math tests: Update after 2019-08-28 change.
	* tests/test-math-c++.cc (isfinite, isinf, isnan, signbit): Expect a
	return type of 'bool', not 'int'.

2019-11-21  Bruno Haible  <bruno@clisp.org>

	Fix various errors in _GL_CXXALIAS_SYS invocations.
	* lib/locale.in.h (freelocale): Use _GL_CXXALIAS_SYS_CAST instead of
	_GL_CXXALIAS_SYS.
	* lib/pthread.in.h (pthread_mutexattr_gettype,
	pthread_mutexattr_getrobust): Likewise.
	* lib/stdlib.in.h (srandom, initstate, setstate): Likewise.
	* lib/sys_socket.in.h (recv, send): Likewise.
	* lib/unistd.in.h (getdtablesize): Likewise.
	* lib/sys_select.in.h (select): In C++, write 'timeval' instead of
	'struct timeval'.

2019-11-21  Bruno Haible  <bruno@clisp.org>

	Disable many _GL_CXXALIASWARN on all platforms other than glibc systems.
	Reported by Christian Biesinger <cbiesinger@google.com> in
	<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00066.html>.
	* lib/fnmatch.in.h (fnmatch): Disable _GL_CXXALIASWARN invocation on
	non-glibc systems.
	* lib/locale.in.h (localeconv, setlocale): Likewise.
	* lib/math.in.h (cbrt, ceil, copysign, exp2, expm1, floor, fma, fmod,
	frexp, hypot, ilogb, log, log10, log1p, log2, logb, modf, remainder,
	rint, round, trunc): Likewise.
	* lib/monetary.in.h (strfmon_l): Likewise.
	* lib/pthread.in.h (pthread_mutexattr_getrobust,
	pthread_mutexattr_setrobust, pthread_mutex_lock, pthread_spin_init,
	pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock,
	pthread_spin_destroy): Likewise.
	* lib/signal.in.h (raise, signal): Likewise.
	* lib/stdio.in.h (fclose, fflush, fgetc, fgets, fopen, fprintf, fputc,
	fputs, fread, freopen, fscanf, fseek, ftell, fwrite, getc, getchar,
	perror, printf, putc, putchar, puts, remove, rename, scanf, sprintf,
	tmpfile, vfprintf, vprintf, vsprintf): Likewise.
	* lib/stdlib.in.h (calloc, malloc, mbtowc, realloc, strtod, wctomb):
	Likewise.
	* lib/string.in.h (memchr, strncat, strpbrk, strstr, strerror):
	Likewise.
	* lib/time.in.h (mktime, localtime, ctime, strftime): Likewise.
	* lib/wchar.in.h (btowc, wctob, mbsinit, mbrtowc, mbrlen, mbsrtowcs,
	wcrtomb, wcsrtombs, wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset,
	wcslen, wcscpy, wcsncpy, wcscat, wcsncat, wcscmp, wcsncmp, wcscoll,
	wcsxfrm, wcschr, wcsrchr, wcscspn, wcsspn, wcspbrk, wcsstr, wcstok,
	wcsftime): Likewise.
	* lib/wctype.in.h (iswblank, wctrans, towctrans): Likewise.


[-- Attachment #2: 0001-pthread-mutex-Fix-errors-in-C-mode.patch --]
[-- Type: text/x-patch, Size: 4616 bytes --]

From aa8aa5d8866366c06d3f06d9ac1cf8cd3614cf88 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Subject: [PATCH 1/5] pthread-mutex: Fix errors in C++ mode.

* m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Test whether
pthread_mutexattr_getrobust exists. If not, define
PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
* lib/pthread-mutex.c (pthread_mutexattr_getrobust,
pthread_mutexattr_setrobust): Define also if <pthread.h> exists but
PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
* modules/pthread-mutex (configure.ac): Compile pthread-mutex.c also
when <pthread.h> exists but pthread_mutexattr_getrobust needs a gnulib
definition.
---
 ChangeLog             | 13 +++++++++++++
 lib/pthread-mutex.c   | 19 +++++++++++++++++++
 m4/pthread-mutex.m4   | 29 ++++++++++++++++++++++++++++-
 modules/pthread-mutex |  3 ++-
 4 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1217f31..4d99aca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2019-11-21  Bruno Haible  <bruno@clisp.org>
+
+	pthread-mutex: Fix errors in C++ mode.
+	* m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Test whether
+	pthread_mutexattr_getrobust exists. If not, define
+	PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
+	* lib/pthread-mutex.c (pthread_mutexattr_getrobust,
+	pthread_mutexattr_setrobust): Define also if <pthread.h> exists but
+	PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
+	* modules/pthread-mutex (configure.ac): Compile pthread-mutex.c also
+	when <pthread.h> exists but pthread_mutexattr_getrobust needs a gnulib
+	definition.
+
 2019-11-19  Bruno Haible  <bruno@clisp.org>
 
 	threads-h tests: Fix typo.
diff --git a/lib/pthread-mutex.c b/lib/pthread-mutex.c
index 7a6fc1a..96a225d 100644
--- a/lib/pthread-mutex.c
+++ b/lib/pthread-mutex.c
@@ -82,6 +82,25 @@ pthread_mutexattr_destroy (pthread_mutexattr_t *attr _GL_UNUSED)
   return 0;
 }
 
+#elif PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED
+
+int
+pthread_mutexattr_getrobust (const pthread_mutexattr_t *attr, int *robustp)
+{
+  *robustp = PTHREAD_MUTEX_STALLED;
+  return 0;
+}
+
+int
+pthread_mutexattr_setrobust (pthread_mutexattr_t *attr, int robust)
+{
+  if (!(robust == PTHREAD_MUTEX_STALLED || robust == PTHREAD_MUTEX_ROBUST))
+    return EINVAL;
+  if (!(robust == PTHREAD_MUTEX_STALLED))
+    return ENOTSUP;
+  return 0;
+}
+
 #endif
 
 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
diff --git a/m4/pthread-mutex.m4 b/m4/pthread-mutex.m4
index c7d74f9..abe5f2f 100644
--- a/m4/pthread-mutex.m4
+++ b/m4/pthread-mutex.m4
@@ -1,4 +1,4 @@
-# pthread-mutex.m4 serial 1
+# pthread-mutex.m4 serial 2
 dnl Copyright (C) 2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -39,6 +39,33 @@ AC_DEFUN([gl_PTHREAD_MUTEX],
       dnl HAVE_PTHREAD_MUTEX_TIMEDLOCK is set in pthread_mutex_timedlock.m4.
       HAVE_PTHREAD_MUTEX_UNLOCK=0
       HAVE_PTHREAD_MUTEX_DESTROY=0
+    else
+      AC_CACHE_CHECK([for pthread_mutexattr_getrobust],
+        [gl_cv_func_pthread_mutexattr_getrobust],
+        [saved_LIBS="$LIBS"
+         LIBS="$LIBS $LIBMULTITHREAD"
+         AC_LINK_IFELSE(
+           [AC_LANG_SOURCE(
+              [[extern
+                #ifdef __cplusplus
+                "C"
+                #endif
+                int pthread_mutexattr_getrobust (void);
+                int main ()
+                {
+                  return pthread_mutexattr_getrobust ();
+                }
+              ]])],
+           [gl_cv_func_pthread_mutexattr_getrobust=yes],
+           [gl_cv_func_pthread_mutexattr_getrobust=no])
+         LIBS="$saved_LIBS"
+        ])
+      if test $gl_cv_func_pthread_mutexattr_getrobust = no; then
+        HAVE_PTHREAD_MUTEXATTR_GETROBUST=0
+        HAVE_PTHREAD_MUTEXATTR_SETROBUST=0
+        AC_DEFINE([PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED], [1],
+          [Define if the 'robust' attribute of pthread_mutex* doesn't exist.])
+      fi
     fi
   fi
 ])
diff --git a/modules/pthread-mutex b/modules/pthread-mutex
index 8e64a9e..71496b7 100644
--- a/modules/pthread-mutex
+++ b/modules/pthread-mutex
@@ -13,7 +13,8 @@ windows-timedrecmutex   [test $gl_threads_api = windows]
 
 configure.ac:
 gl_PTHREAD_MUTEX
-if test $HAVE_PTHREAD_MUTEX_INIT = 0 || test $REPLACE_PTHREAD_MUTEX_INIT = 1; then
+if test $HAVE_PTHREAD_MUTEX_INIT = 0 || test $REPLACE_PTHREAD_MUTEX_INIT = 1 \
+   || test $HAVE_PTHREAD_MUTEXATTR_GETROBUST = 0 || test $REPLACE_PTHREAD_MUTEXATTR_GETROBUST = 1; then
   AC_LIBOBJ([pthread-mutex])
 fi
 gl_PTHREAD_MODULE_INDICATOR([pthread-mutex])
-- 
2.7.4


[-- Attachment #3: 0002-pthread-spin-Fix-errors-in-C-mode.patch --]
[-- Type: text/x-patch, Size: 1749 bytes --]

From 381bf82ca7834d90974821f42179afcf46e2b357 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Subject: [PATCH 2/5] pthread-spin: Fix errors in C++ mode.

* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Mark the pthread_spin_*
functions as nonexistent when <pthread.h> exists but does not define
the pthread_spinlock_t type.
---
 ChangeLog          | 7 +++++++
 m4/pthread-spin.m4 | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4d99aca..23e8176 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2019-11-21  Bruno Haible  <bruno@clisp.org>
 
+	pthread-spin: Fix errors in C++ mode.
+	* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Mark the pthread_spin_*
+	functions as nonexistent when <pthread.h> exists but does not define
+	the pthread_spinlock_t type.
+
+2019-11-21  Bruno Haible  <bruno@clisp.org>
+
 	pthread-mutex: Fix errors in C++ mode.
 	* m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Test whether
 	pthread_mutexattr_getrobust exists. If not, define
diff --git a/m4/pthread-spin.m4 b/m4/pthread-spin.m4
index 9352d5a..c546e2f 100644
--- a/m4/pthread-spin.m4
+++ b/m4/pthread-spin.m4
@@ -1,4 +1,4 @@
-# pthread-spin.m4 serial 1
+# pthread-spin.m4 serial 2
 dnl Copyright (C) 2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,7 +19,7 @@ AC_DEFUN([gl_PTHREAD_SPIN],
     REPLACE_PTHREAD_SPIN_UNLOCK=1
     REPLACE_PTHREAD_SPIN_DESTROY=1
   else
-    if test $HAVE_PTHREAD_H = 0; then
+    if test $HAVE_PTHREAD_H = 0 || test $HAVE_PTHREAD_SPINLOCK_T = 0; then
       HAVE_PTHREAD_SPIN_INIT=0
       HAVE_PTHREAD_SPIN_LOCK=0
       HAVE_PTHREAD_SPIN_TRYLOCK=0
-- 
2.7.4


[-- Attachment #4: 0003-math-tests-Update-after-2019-08-28-change.patch --]
[-- Type: text/x-patch, Size: 2122 bytes --]

From cf6577a5d8fe4497e57e4c2719d50fffd9388aa7 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Subject: [PATCH 3/5] math tests: Update after 2019-08-28 change.

* tests/test-math-c++.cc (isfinite, isinf, isnan, signbit): Expect a
return type of 'bool', not 'int'.
---
 ChangeLog              | 6 ++++++
 tests/test-math-c++.cc | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 23e8176..f60daa0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-11-21  Bruno Haible  <bruno@clisp.org>
+
+	math tests: Update after 2019-08-28 change.
+	* tests/test-math-c++.cc (isfinite, isinf, isnan, signbit): Expect a
+	return type of 'bool', not 'int'.
+
 2019-11-21  Bruno Haible  <bruno@clisp.org>
 
 	pthread-spin: Fix errors in C++ mode.
diff --git a/tests/test-math-c++.cc b/tests/test-math-c++.cc
index 74569d3..57bfd1b 100644
--- a/tests/test-math-c++.cc
+++ b/tests/test-math-c++.cc
@@ -385,28 +385,28 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
 # ifdef isfinite
 #  error "isfinite should not be a macro in C++"
 # endif
-REAL_FLOATING_CHECK (isfinite, int, (float), int, (double), int, (long double));
+REAL_FLOATING_CHECK (isfinite, bool, (float), bool, (double), bool, (long double));
 #endif
 
 #if GNULIB_TEST_ISINF
 # ifdef isinf
 #  error "isinf should not be a macro in C++"
 # endif
-REAL_FLOATING_CHECK (isinf, int, (float), int, (double), int, (long double));
+REAL_FLOATING_CHECK (isinf, bool, (float), bool, (double), bool, (long double));
 #endif
 
 #if GNULIB_TEST_ISNAN
 # ifdef isnan
 #  error "isnan should not be a macro in C++"
 # endif
-REAL_FLOATING_CHECK (isnan, int, (float), int, (double), int, (long double));
+REAL_FLOATING_CHECK (isnan, bool, (float), bool, (double), bool, (long double));
 #endif
 
 #if GNULIB_TEST_SIGNBIT
 # ifdef signbit
 #  error "signbit should not be a macro in C++"
 # endif
-REAL_FLOATING_CHECK (signbit, int, (float), int, (double), int, (long double));
+REAL_FLOATING_CHECK (signbit, bool, (float), bool, (double), bool, (long double));
 #endif
 
 
-- 
2.7.4


[-- Attachment #5: 0004-Fix-various-errors-in-_GL_CXXALIAS_SYS-invocations.patch --]
[-- Type: text/x-patch, Size: 7746 bytes --]

From 2ef87ea7645564d65b1d747acb8da4b190def644 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Subject: [PATCH 4/5] Fix various errors in _GL_CXXALIAS_SYS invocations.

* lib/locale.in.h (freelocale): Use _GL_CXXALIAS_SYS_CAST instead of
_GL_CXXALIAS_SYS.
* lib/pthread.in.h (pthread_mutexattr_gettype,
pthread_mutexattr_getrobust): Likewise.
* lib/stdlib.in.h (srandom, initstate, setstate): Likewise.
* lib/sys_socket.in.h (recv, send): Likewise.
* lib/unistd.in.h (getdtablesize): Likewise.
* lib/sys_select.in.h (select): In C++, write 'timeval' instead of
'struct timeval'.
---
 ChangeLog           | 13 +++++++++++++
 lib/locale.in.h     |  4 +++-
 lib/pthread.in.h    | 12 ++++++++----
 lib/stdlib.in.h     | 14 ++++++++++----
 lib/sys_select.in.h |  2 +-
 lib/sys_socket.in.h | 12 +++++++++---
 lib/unistd.in.h     |  4 +++-
 7 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f60daa0..6a84116 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2019-11-21  Bruno Haible  <bruno@clisp.org>
+
+	Fix various errors in _GL_CXXALIAS_SYS invocations.
+	* lib/locale.in.h (freelocale): Use _GL_CXXALIAS_SYS_CAST instead of
+	_GL_CXXALIAS_SYS.
+	* lib/pthread.in.h (pthread_mutexattr_gettype,
+	pthread_mutexattr_getrobust): Likewise.
+	* lib/stdlib.in.h (srandom, initstate, setstate): Likewise.
+	* lib/sys_socket.in.h (recv, send): Likewise.
+	* lib/unistd.in.h (getdtablesize): Likewise.
+	* lib/sys_select.in.h (select): In C++, write 'timeval' instead of
+	'struct timeval'.
+
 2019-11-21  Bruno Haible  <bruno@clisp.org>
 
 	math tests: Update after 2019-08-28 change.
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 97479db..efc29b4 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -254,7 +254,9 @@ _GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale));
 # else
 #  if @HAVE_FREELOCALE@
-_GL_CXXALIAS_SYS (freelocale, void, (locale_t locale));
+/* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
+                                   int.  */
+_GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale));
 #  endif
 # endif
 # if @HAVE_FREELOCALE@
diff --git a/lib/pthread.in.h b/lib/pthread.in.h
index 9c0a422..3a379d0 100644
--- a/lib/pthread.in.h
+++ b/lib/pthread.in.h
@@ -804,8 +804,10 @@ _GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
                   (const pthread_mutexattr_t *attr, int *typep)
                   _GL_ARG_NONNULL ((1, 2)));
 #  endif
-_GL_CXXALIAS_SYS (pthread_mutexattr_gettype, int,
-                  (const pthread_mutexattr_t *attr, int *typep));
+/* Need to cast, because on FreeBSD the first parameter is
+                        pthread_mutexattr_t *attr.  */
+_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
+                       (const pthread_mutexattr_t *attr, int *typep));
 # endif
 _GL_CXXALIASWARN (pthread_mutexattr_gettype);
 #elif defined GNULIB_POSIXCHECK
@@ -860,8 +862,10 @@ _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
                   (const pthread_mutexattr_t *attr, int *robustp)
                   _GL_ARG_NONNULL ((1, 2)));
 #  endif
-_GL_CXXALIAS_SYS (pthread_mutexattr_getrobust, int,
-                  (const pthread_mutexattr_t *attr, int *robustp));
+/* Need to cast, because on FreeBSD the first parameter is
+                        pthread_mutexattr_t *attr.  */
+_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
+                       (const pthread_mutexattr_t *attr, int *robustp));
 # endif
 _GL_CXXALIASWARN (pthread_mutexattr_getrobust);
 #elif defined GNULIB_POSIXCHECK
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index e5583d9..96c48fe 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -616,7 +616,9 @@ _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
 #  if !@HAVE_RANDOM@
 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
 #  endif
-_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
+/* Need to cast, because on FreeBSD, the first parameter is
+                                       unsigned long seed.  */
+_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
 # endif
 _GL_CXXALIASWARN (srandom);
 #elif defined GNULIB_POSIXCHECK
@@ -644,8 +646,10 @@ _GL_FUNCDECL_SYS (initstate, char *,
                   (unsigned int seed, char *buf, size_t buf_size)
                   _GL_ARG_NONNULL ((2)));
 #  endif
-_GL_CXXALIAS_SYS (initstate, char *,
-                  (unsigned int seed, char *buf, size_t buf_size));
+/* Need to cast, because on FreeBSD, the first parameter is
+                        unsigned long seed.  */
+_GL_CXXALIAS_SYS_CAST (initstate, char *,
+                       (unsigned int seed, char *buf, size_t buf_size));
 # endif
 _GL_CXXALIASWARN (initstate);
 #elif defined GNULIB_POSIXCHECK
@@ -668,7 +672,9 @@ _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
 #  if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
 #  endif
-_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
+/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
+   is                                     const char *arg_state.  */
+_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
 # endif
 _GL_CXXALIASWARN (setstate);
 #elif defined GNULIB_POSIXCHECK
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index bc67bcf..e264257 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -299,7 +299,7 @@ _GL_CXXALIAS_RPL (select, int,
 # else
 _GL_CXXALIAS_SYS (select, int,
                   (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
-                   struct timeval *restrict));
+                   timeval *restrict));
 # endif
 _GL_CXXALIASWARN (select);
 #elif @HAVE_WINSOCK2_H@
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index 19ee961..5bcee9e 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -517,7 +517,10 @@ _GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
                                  _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
 # else
-_GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
+/* Need to cast, because on HP-UX 11.31 the return type may be
+                             int,
+   depending on compiler options.  */
+_GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
 # endif
 _GL_CXXALIASWARN (recv);
 #elif @HAVE_WINSOCK2_H@
@@ -543,8 +546,11 @@ _GL_FUNCDECL_RPL (send, ssize_t,
 _GL_CXXALIAS_RPL (send, ssize_t,
                   (int fd, const void *buf, size_t len, int flags));
 # else
-_GL_CXXALIAS_SYS (send, ssize_t,
-                  (int fd, const void *buf, size_t len, int flags));
+/* Need to cast, because on HP-UX 11.31 the return type may be
+                             int,
+   depending on compiler options.  */
+_GL_CXXALIAS_SYS_CAST (send, ssize_t,
+                       (int fd, const void *buf, size_t len, int flags));
 # endif
 _GL_CXXALIASWARN (send);
 #elif @HAVE_WINSOCK2_H@
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 90dbfee..2fa25b4 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -749,7 +749,9 @@ _GL_CXXALIAS_RPL (getdtablesize, int, (void));
 #  if !@HAVE_GETDTABLESIZE@
 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
 #  endif
-_GL_CXXALIAS_SYS (getdtablesize, int, (void));
+/* Need to cast, because on AIX, the parameter list is
+                                           (...).  */
+_GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
 # endif
 _GL_CXXALIASWARN (getdtablesize);
 #elif defined GNULIB_POSIXCHECK
-- 
2.7.4


[-- Attachment #6: 0005-Disable-many-_GL_CXXALIASWARN-on-all-platforms-other.patch --]
[-- Type: text/x-patch, Size: 40193 bytes --]

From 255607795d6a624cc040cbbe563e89a70acb81fe Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Subject: [PATCH 5/5] Disable many _GL_CXXALIASWARN on all platforms other than
 glibc systems.

Reported by Christian Biesinger <cbiesinger@google.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00066.html>.

* lib/fnmatch.in.h (fnmatch): Disable _GL_CXXALIASWARN invocation on
non-glibc systems.
* lib/locale.in.h (localeconv, setlocale): Likewise.
* lib/math.in.h (cbrt, ceil, copysign, exp2, expm1, floor, fma, fmod,
frexp, hypot, ilogb, log, log10, log1p, log2, logb, modf, remainder,
rint, round, trunc): Likewise.
* lib/monetary.in.h (strfmon_l): Likewise.
* lib/pthread.in.h (pthread_mutexattr_getrobust,
pthread_mutexattr_setrobust, pthread_mutex_lock, pthread_spin_init,
pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock,
pthread_spin_destroy): Likewise.
* lib/signal.in.h (raise, signal): Likewise.
* lib/stdio.in.h (fclose, fflush, fgetc, fgets, fopen, fprintf, fputc,
fputs, fread, freopen, fscanf, fseek, ftell, fwrite, getc, getchar,
perror, printf, putc, putchar, puts, remove, rename, scanf, sprintf,
tmpfile, vfprintf, vprintf, vsprintf): Likewise.
* lib/stdlib.in.h (calloc, malloc, mbtowc, realloc, strtod, wctomb):
Likewise.
* lib/string.in.h (memchr, strncat, strpbrk, strstr, strerror):
Likewise.
* lib/time.in.h (mktime, localtime, ctime, strftime): Likewise.
* lib/wchar.in.h (btowc, wctob, mbsinit, mbrtowc, mbrlen, mbsrtowcs,
wcrtomb, wcsrtombs, wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset,
wcslen, wcscpy, wcsncpy, wcscat, wcsncat, wcscmp, wcsncmp, wcscoll,
wcsxfrm, wcschr, wcsrchr, wcscspn, wcsspn, wcspbrk, wcsstr, wcstok,
wcsftime): Likewise.
* lib/wctype.in.h (iswblank, wctrans, towctrans): Likewise.
---
 ChangeLog         | 33 ++++++++++++++++++++++++++++++
 lib/fnmatch.in.h  |  2 +-
 lib/locale.in.h   |  4 ++++
 lib/math.in.h     | 42 ++++++++++++++++++++++++++++++++++++++
 lib/monetary.in.h |  2 ++
 lib/pthread.in.h  | 16 +++++++++++++++
 lib/signal.in.h   |  4 ++++
 lib/stdio.in.h    | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/stdlib.in.h   | 12 +++++++++++
 lib/string.in.h   | 10 +++++++---
 lib/time.in.h     |  8 ++++++++
 lib/wchar.in.h    | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 lib/wctype.in.h   |  6 ++++++
 13 files changed, 248 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6a84116..7ceea18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2019-11-21  Bruno Haible  <bruno@clisp.org>
+
+	Disable many _GL_CXXALIASWARN on all platforms other than glibc systems.
+	Reported by Christian Biesinger <cbiesinger@google.com> in
+	<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00066.html>.
+	* lib/fnmatch.in.h (fnmatch): Disable _GL_CXXALIASWARN invocation on
+	non-glibc systems.
+	* lib/locale.in.h (localeconv, setlocale): Likewise.
+	* lib/math.in.h (cbrt, ceil, copysign, exp2, expm1, floor, fma, fmod,
+	frexp, hypot, ilogb, log, log10, log1p, log2, logb, modf, remainder,
+	rint, round, trunc): Likewise.
+	* lib/monetary.in.h (strfmon_l): Likewise.
+	* lib/pthread.in.h (pthread_mutexattr_getrobust,
+	pthread_mutexattr_setrobust, pthread_mutex_lock, pthread_spin_init,
+	pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock,
+	pthread_spin_destroy): Likewise.
+	* lib/signal.in.h (raise, signal): Likewise.
+	* lib/stdio.in.h (fclose, fflush, fgetc, fgets, fopen, fprintf, fputc,
+	fputs, fread, freopen, fscanf, fseek, ftell, fwrite, getc, getchar,
+	perror, printf, putc, putchar, puts, remove, rename, scanf, sprintf,
+	tmpfile, vfprintf, vprintf, vsprintf): Likewise.
+	* lib/stdlib.in.h (calloc, malloc, mbtowc, realloc, strtod, wctomb):
+	Likewise.
+	* lib/string.in.h (memchr, strncat, strpbrk, strstr, strerror):
+	Likewise.
+	* lib/time.in.h (mktime, localtime, ctime, strftime): Likewise.
+	* lib/wchar.in.h (btowc, wctob, mbsinit, mbrtowc, mbrlen, mbsrtowcs,
+	wcrtomb, wcsrtombs, wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset,
+	wcslen, wcscpy, wcsncpy, wcscat, wcsncat, wcscmp, wcsncmp, wcscoll,
+	wcsxfrm, wcschr, wcsrchr, wcscspn, wcsspn, wcspbrk, wcsstr, wcstok,
+	wcsftime): Likewise.
+	* lib/wctype.in.h (iswblank, wctrans, towctrans): Likewise.
+
 2019-11-21  Bruno Haible  <bruno@clisp.org>
 
 	Fix various errors in _GL_CXXALIAS_SYS invocations.
diff --git a/lib/fnmatch.in.h b/lib/fnmatch.in.h
index cf34009..31d2573 100644
--- a/lib/fnmatch.in.h
+++ b/lib/fnmatch.in.h
@@ -93,7 +93,7 @@ _GL_FUNCDECL_SYS (fnmatch, int,
 _GL_CXXALIAS_SYS (fnmatch, int,
                   (const char *pattern, const char *name, int flags));
 # endif
-# if !GNULIB_FNMATCH_GNU
+# if !GNULIB_FNMATCH_GNU && __GLIBC__ >= 2
 _GL_CXXALIASWARN (fnmatch);
 # endif
 #elif defined GNULIB_POSIXCHECK
diff --git a/lib/locale.in.h b/lib/locale.in.h
index efc29b4..918d4dd 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -156,7 +156,9 @@ _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
 # else
 _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (localeconv);
+# endif
 #elif @REPLACE_STRUCT_LCONV@
 # undef localeconv
 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
@@ -181,7 +183,9 @@ _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
 # else
 _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (setlocale);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef setlocale
 # if HAVE_RAW_DECL_SETLOCALE
diff --git a/lib/math.in.h b/lib/math.in.h
index 538d332..3aa7f4e 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -398,7 +398,9 @@ _GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - "
 _GL_FUNCDECL_SYS (cbrt, double, (double x));
 # endif
 _GL_CXXALIAS_SYS (cbrt, double, (double x));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (cbrt);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef cbrt
 # if HAVE_RAW_DECL_CBRT
@@ -466,7 +468,9 @@ _GL_CXXALIAS_RPL (ceil, double, (double x));
 # else
 _GL_CXXALIAS_SYS (ceil, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (ceil);
+# endif
 #endif
 
 #if @GNULIB_CEILL@
@@ -513,7 +517,9 @@ _GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
 _GL_FUNCDECL_SYS (copysign, double, (double x, double y));
 # endif
 _GL_CXXALIAS_SYS (copysign, double, (double x, double y));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (copysign);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef copysign
 # if HAVE_RAW_DECL_COPYSIGN
@@ -679,7 +685,9 @@ _GL_FUNCDECL_SYS (exp2, double, (double x));
 #  endif
 _GL_CXXALIAS_SYS (exp2, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (exp2);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef exp2
 # if HAVE_RAW_DECL_EXP2
@@ -750,7 +758,9 @@ _GL_FUNCDECL_SYS (expm1, double, (double x));
 #  endif
 _GL_CXXALIAS_SYS (expm1, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (expm1);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef expm1
 # if HAVE_RAW_DECL_EXPM1
@@ -859,7 +869,9 @@ _GL_CXXALIAS_RPL (floor, double, (double x));
 # else
 _GL_CXXALIAS_SYS (floor, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (floor);
+# endif
 #endif
 
 #if @GNULIB_FLOORL@
@@ -924,7 +936,9 @@ _GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
 #  endif
 _GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fma);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef fma
 # if HAVE_RAW_DECL_FMA
@@ -997,7 +1011,9 @@ _GL_CXXALIAS_RPL (fmod, double, (double x, double y));
 # else
 _GL_CXXALIAS_SYS (fmod, double, (double x, double y));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fmod);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef fmod
 # if HAVE_RAW_DECL_FMOD
@@ -1080,7 +1096,9 @@ _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
 # else
 _GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef frexp
 /* Assume frexp is always declared.  */
@@ -1160,7 +1178,9 @@ _GL_CXXALIAS_RPL (hypot, double, (double x, double y));
 # else
 _GL_CXXALIAS_SYS (hypot, double, (double x, double y));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (hypot);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef hypot
 # if HAVE_RAW_DECL_HYPOT
@@ -1231,7 +1251,9 @@ _GL_FUNCDECL_SYS (ilogb, int, (double x));
 #  endif
 _GL_CXXALIAS_SYS (ilogb, int, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (ilogb);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef ilogb
 # if HAVE_RAW_DECL_ILOGB
@@ -1343,7 +1365,9 @@ _GL_CXXALIAS_RPL (log, double, (double x));
 # else
 _GL_CXXALIAS_SYS (log, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (log);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef log
 # if HAVE_RAW_DECL_LOG
@@ -1412,7 +1436,9 @@ _GL_CXXALIAS_RPL (log10, double, (double x));
 # else
 _GL_CXXALIAS_SYS (log10, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (log10);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef log10
 # if HAVE_RAW_DECL_LOG10
@@ -1483,7 +1509,9 @@ _GL_FUNCDECL_SYS (log1p, double, (double x));
 #  endif
 _GL_CXXALIAS_SYS (log1p, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (log1p);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef log1p
 # if HAVE_RAW_DECL_LOG1P
@@ -1555,7 +1583,9 @@ _GL_FUNCDECL_SYS (log2, double, (double x));
 #  endif
 _GL_CXXALIAS_SYS (log2, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (log2);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef log2
 # if HAVE_RAW_DECL_LOG2
@@ -1625,7 +1655,9 @@ _GL_FUNCDECL_SYS (logb, double, (double x));
 #  endif
 _GL_CXXALIAS_SYS (logb, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (logb);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef logb
 # if HAVE_RAW_DECL_LOGB
@@ -1693,7 +1725,9 @@ _GL_CXXALIAS_RPL (modf, double, (double x, double *iptr));
 # else
 _GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (modf);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef modf
 # if HAVE_RAW_DECL_MODF
@@ -1782,7 +1816,9 @@ _GL_FUNCDECL_SYS (remainder, double, (double x, double y));
 #  endif
 _GL_CXXALIAS_SYS (remainder, double, (double x, double y));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (remainder);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef remainder
 # if HAVE_RAW_DECL_REMAINDER
@@ -1835,7 +1871,9 @@ _GL_WARN_ON_USE (rintf, "rintf is unportable - "
 _GL_FUNCDECL_SYS (rint, double, (double x));
 # endif
 _GL_CXXALIAS_SYS (rint, double, (double x));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (rint);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef rint
 # if HAVE_RAW_DECL_RINT
@@ -1905,7 +1943,9 @@ _GL_FUNCDECL_SYS (round, double, (double x));
 #  endif
 _GL_CXXALIAS_SYS (round, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (round);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef round
 # if HAVE_RAW_DECL_ROUND
@@ -2155,7 +2195,9 @@ _GL_FUNCDECL_SYS (trunc, double, (double x));
 #  endif
 _GL_CXXALIAS_SYS (trunc, double, (double x));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (trunc);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef trunc
 # if HAVE_RAW_DECL_TRUNC
diff --git a/lib/monetary.in.h b/lib/monetary.in.h
index d56b6cf..3157cd7 100644
--- a/lib/monetary.in.h
+++ b/lib/monetary.in.h
@@ -91,7 +91,9 @@ _GL_CXXALIAS_SYS (strfmon_l, ssize_t, (char *s, size_t maxsize, locale_t locale,
                                        const char *format, ...));
 #  endif
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (strfmon_l);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef strfmon_l
 # if HAVE_RAW_DECL_STRFMON_L
diff --git a/lib/pthread.in.h b/lib/pthread.in.h
index 3a379d0..e564140 100644
--- a/lib/pthread.in.h
+++ b/lib/pthread.in.h
@@ -867,7 +867,9 @@ _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
                        (const pthread_mutexattr_t *attr, int *robustp));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (pthread_mutexattr_getrobust);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef pthread_mutexattr_getrobust
 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
@@ -896,7 +898,9 @@ _GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
 _GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
                   (pthread_mutexattr_t *attr, int robust));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (pthread_mutexattr_setrobust);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef pthread_mutexattr_setrobust
 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
@@ -946,7 +950,9 @@ _GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
 #  endif
 _GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (pthread_mutex_lock);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef pthread_mutex_lock
 # if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
@@ -1694,7 +1700,9 @@ _GL_FUNCDECL_SYS (pthread_spin_init, int,
 _GL_CXXALIAS_SYS (pthread_spin_init, int,
                   (pthread_spinlock_t *lock, int shared_across_processes));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (pthread_spin_init);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef pthread_spin_init
 # if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
@@ -1719,7 +1727,9 @@ _GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)
 #  endif
 _GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (pthread_spin_lock);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef pthread_spin_lock
 # if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
@@ -1744,7 +1754,9 @@ _GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
 #  endif
 _GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (pthread_spin_trylock);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef pthread_spin_trylock
 # if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
@@ -1769,7 +1781,9 @@ _GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
 #  endif
 _GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (pthread_spin_unlock);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef pthread_spin_unlock
 # if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
@@ -1794,7 +1808,9 @@ _GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
 #  endif
 _GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (pthread_spin_destroy);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef pthread_spin_destroy
 # if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
diff --git a/lib/signal.in.h b/lib/signal.in.h
index a6960a2..0f6486d 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -168,7 +168,9 @@ _GL_FUNCDECL_SYS (raise, int, (int sig));
 #  endif
 _GL_CXXALIAS_SYS (raise, int, (int sig));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (raise);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef raise
 /* Assume raise is always declared.  */
@@ -321,7 +323,9 @@ _GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
 _GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
                   (int sig, _gl_function_taking_int_returning_void_t func));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (signal);
+# endif
 
 # if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
 /* Raise signal SIGPIPE.  */
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 98c8093..4aea52c 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -203,7 +203,9 @@ _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
 # else
 _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fclose);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef fclose
 /* Assume fclose is always declared.  */
@@ -247,7 +249,9 @@ _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
 # else
 _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fflush);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef fflush
 /* Assume fflush is always declared.  */
@@ -266,7 +270,9 @@ _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
 # else
 _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fgetc);
+# endif
 #endif
 
 #if @GNULIB_FGETS@
@@ -281,7 +287,9 @@ _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
 # else
 _GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fgets);
+# endif
 #endif
 
 #if @GNULIB_FOPEN@
@@ -296,7 +304,9 @@ _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
 # else
 _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fopen);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef fopen
 /* Assume fopen is always declared.  */
@@ -324,7 +334,9 @@ _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
 # else
 _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fprintf);
+# endif
 #endif
 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
 # if !GNULIB_overrides_fprintf
@@ -375,7 +387,9 @@ _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
 # else
 _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fputc);
+# endif
 #endif
 
 #if @GNULIB_FPUTS@
@@ -390,7 +404,9 @@ _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
 # else
 _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fputs);
+# endif
 #endif
 
 #if @GNULIB_FREAD@
@@ -405,7 +421,9 @@ _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
 # else
 _GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fread);
+# endif
 #endif
 
 #if @GNULIB_FREOPEN@
@@ -423,7 +441,9 @@ _GL_CXXALIAS_RPL (freopen, FILE *,
 _GL_CXXALIAS_SYS (freopen, FILE *,
                   (const char *filename, const char *mode, FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (freopen);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef freopen
 /* Assume freopen is always declared.  */
@@ -445,7 +465,9 @@ _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
 # else
 _GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fscanf);
+# endif
 #endif
 
 
@@ -496,7 +518,9 @@ _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
 # else
 _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fseek);
+# endif
 #endif
 
 #if @GNULIB_FSEEKO@
@@ -559,7 +583,9 @@ _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
 # else
 _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (ftell);
+# endif
 #endif
 
 #if @GNULIB_FTELLO@
@@ -639,7 +665,9 @@ extern size_t __REDIRECT (rpl_fwrite_unlocked,
 #   define fwrite_unlocked rpl_fwrite_unlocked
 #  endif
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fwrite);
+# endif
 #endif
 
 #if @GNULIB_GETC@
@@ -653,7 +681,9 @@ _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
 # else
 _GL_CXXALIAS_SYS (getc, int, (FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getc);
+# endif
 #endif
 
 #if @GNULIB_GETCHAR@
@@ -667,7 +697,9 @@ _GL_CXXALIAS_RPL (getchar, int, (void));
 # else
 _GL_CXXALIAS_SYS (getchar, int, (void));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getchar);
+# endif
 #endif
 
 #if @GNULIB_GETDELIM@
@@ -832,7 +864,9 @@ _GL_CXXALIAS_RPL (perror, void, (const char *string));
 # else
 _GL_CXXALIAS_SYS (perror, void, (const char *string));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (perror);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef perror
 /* Assume perror is always declared.  */
@@ -903,7 +937,9 @@ _GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
 # else
 _GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (printf);
+# endif
 #endif
 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
 # if !GNULIB_overrides_printf
@@ -926,7 +962,9 @@ _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
 # else
 _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (putc);
+# endif
 #endif
 
 #if @GNULIB_PUTCHAR@
@@ -940,7 +978,9 @@ _GL_CXXALIAS_RPL (putchar, int, (int c));
 # else
 _GL_CXXALIAS_SYS (putchar, int, (int c));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (putchar);
+# endif
 #endif
 
 #if @GNULIB_PUTS@
@@ -954,7 +994,9 @@ _GL_CXXALIAS_RPL (puts, int, (const char *string));
 # else
 _GL_CXXALIAS_SYS (puts, int, (const char *string));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (puts);
+# endif
 #endif
 
 #if @GNULIB_REMOVE@
@@ -968,7 +1010,9 @@ _GL_CXXALIAS_RPL (remove, int, (const char *name));
 # else
 _GL_CXXALIAS_SYS (remove, int, (const char *name));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (remove);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef remove
 /* Assume remove is always declared.  */
@@ -991,7 +1035,9 @@ _GL_CXXALIAS_RPL (rename, int,
 _GL_CXXALIAS_SYS (rename, int,
                   (const char *old_filename, const char *new_filename));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (rename);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef rename
 /* Assume rename is always declared.  */
@@ -1056,7 +1102,9 @@ _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
 # else
 _GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (scanf);
+# endif
 #endif
 
 #if @GNULIB_SNPRINTF@
@@ -1110,7 +1158,9 @@ _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
 # else
 _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (sprintf);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef sprintf
 /* Assume sprintf is always declared.  */
@@ -1129,7 +1179,9 @@ _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
 # else
 _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (tmpfile);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef tmpfile
 # if HAVE_RAW_DECL_TMPFILE
@@ -1240,7 +1292,9 @@ _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
 _GL_CXXALIAS_SYS_CAST (vfprintf, int,
                        (FILE *fp, const char *format, va_list args));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (vfprintf);
+# endif
 #endif
 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
 # if !GNULIB_overrides_vfprintf
@@ -1294,7 +1348,9 @@ _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
    and GCC's fixincludes did not change this to __gnuc_va_list.  */
 _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (vprintf);
+# endif
 #endif
 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
 # if !GNULIB_overrides_vprintf
@@ -1370,7 +1426,9 @@ _GL_CXXALIAS_RPL (vsprintf, int,
 _GL_CXXALIAS_SYS_CAST (vsprintf, int,
                        (char *str, const char *format, va_list args));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (vsprintf);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsprintf
 /* Assume vsprintf is always declared.  */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 96c48fe..2d02b4b 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -176,7 +176,9 @@ _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
 # else
 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (calloc);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef calloc
 /* Assume calloc is always declared.  */
@@ -288,7 +290,9 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
 # else
 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (malloc);
+# endif
 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
 # undef malloc
 /* Assume malloc is always declared.  */
@@ -311,7 +315,9 @@ _GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
 #  endif
 _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (mbtowc);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbtowc
 # if HAVE_RAW_DECL_MBTOWC
@@ -815,7 +821,9 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
 # else
 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (realloc);
+# endif
 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
 # undef realloc
 /* Assume realloc is always declared.  */
@@ -946,7 +954,9 @@ _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
 #  endif
 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (strtod);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtod
 # if HAVE_RAW_DECL_STRTOD
@@ -1085,7 +1095,9 @@ _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
 # else
 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wctomb);
+# endif
 #endif
 
 
diff --git a/lib/string.in.h b/lib/string.in.h
index 14423b0..c6b99a4 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -149,7 +149,7 @@ _GL_CXXALIAS_SYS_CAST2 (memchr,
 _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
 _GL_CXXALIASWARN1 (memchr, void const *,
                    (void const *__s, int __c, size_t __n));
-# else
+# elif __GLIBC__ >= 2
 _GL_CXXALIASWARN (memchr);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -417,7 +417,9 @@ _GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
 # else
 _GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (strncat);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef strncat
 # if HAVE_RAW_DECL_STRNCAT
@@ -512,7 +514,7 @@ _GL_CXXALIAS_SYS_CAST2 (strpbrk,
 _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
 _GL_CXXALIASWARN1 (strpbrk, char const *,
                    (char const *__s, char const *__accept));
-# else
+# elif __GLIBC__ >= 2
 _GL_CXXALIASWARN (strpbrk);
 # endif
 # if defined GNULIB_POSIXCHECK
@@ -614,7 +616,7 @@ _GL_CXXALIAS_SYS_CAST2 (strstr,
 _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
 _GL_CXXALIASWARN1 (strstr, const char *,
                    (const char *haystack, const char *needle));
-# else
+# elif __GLIBC__ >= 2
 _GL_CXXALIASWARN (strstr);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -980,7 +982,9 @@ _GL_CXXALIAS_RPL (strerror, char *, (int));
 # else
 _GL_CXXALIAS_SYS (strerror, char *, (int));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (strerror);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
 /* Assume strerror is always declared.  */
diff --git a/lib/time.in.h b/lib/time.in.h
index dc00503..6402d23 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -155,7 +155,9 @@ _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
 #  else
 _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
 #  endif
+#  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (mktime);
+#  endif
 # endif
 
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
@@ -223,7 +225,9 @@ _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
 #  else
 _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
 #  endif
+#  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (localtime);
+#  endif
 # endif
 
 # if 0 || @REPLACE_GMTIME@
@@ -270,7 +274,9 @@ _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
 #  else
 _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp));
 #  endif
+#  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (ctime);
+#  endif
 # endif
 
 /* Convert *TP to a date and time string.  See
@@ -289,7 +295,9 @@ _GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize,
 _GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize,
                                      const char *__fmt, const struct tm *__tp));
 #  endif
+#  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (strftime);
+#  endif
 # endif
 
 # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index a10b6f2..3ebcdba 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -163,7 +163,9 @@ _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
 #  endif
 _GL_CXXALIAS_SYS (btowc, wint_t, (int c));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (btowc);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
 # if HAVE_RAW_DECL_BTOWC
@@ -189,7 +191,9 @@ _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
 #  endif
 _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wctob);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
 # if HAVE_RAW_DECL_WCTOB
@@ -214,7 +218,9 @@ _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
 #  endif
 _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (mbsinit);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
 # if HAVE_RAW_DECL_MBSINIT
@@ -243,7 +249,9 @@ _GL_FUNCDECL_SYS (mbrtowc, size_t,
 _GL_CXXALIAS_SYS (mbrtowc, size_t,
                   (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (mbrtowc);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
 # if HAVE_RAW_DECL_MBRTOWC
@@ -268,7 +276,9 @@ _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
 #  endif
 _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (mbrlen);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
 # if HAVE_RAW_DECL_MBRLEN
@@ -301,7 +311,9 @@ _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
                   (wchar_t *dest, const char **srcp, size_t len,
                    mbstate_t *ps));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (mbsrtowcs);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
 # if HAVE_RAW_DECL_MBSRTOWCS
@@ -361,7 +373,9 @@ _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
 #  endif
 _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcrtomb);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
 # if HAVE_RAW_DECL_WCRTOMB
@@ -394,7 +408,9 @@ _GL_CXXALIAS_SYS (wcsrtombs, size_t,
                   (char *dest, const wchar_t **srcp, size_t len,
                    mbstate_t *ps));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsrtombs);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
 # if HAVE_RAW_DECL_WCSRTOMBS
@@ -484,7 +500,7 @@ _GL_CXXALIAS_SYS_CAST2 (wmemchr,
 _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
 _GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
                    (const wchar_t *s, wchar_t c, size_t n));
-# else
+# elif __GLIBC__ >= 2
 _GL_CXXALIASWARN (wmemchr);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -505,7 +521,9 @@ _GL_FUNCDECL_SYS (wmemcmp, int,
 # endif
 _GL_CXXALIAS_SYS (wmemcmp, int,
                   (const wchar_t *s1, const wchar_t *s2, size_t n));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wmemcmp);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wmemcmp
 # if HAVE_RAW_DECL_WMEMCMP
@@ -523,7 +541,9 @@ _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
 # endif
 _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
                   (wchar_t *dest, const wchar_t *src, size_t n));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wmemcpy);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wmemcpy
 # if HAVE_RAW_DECL_WMEMCPY
@@ -542,7 +562,9 @@ _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
 # endif
 _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
                   (wchar_t *dest, const wchar_t *src, size_t n));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wmemmove);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wmemmove
 # if HAVE_RAW_DECL_WMEMMOVE
@@ -558,7 +580,9 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
 _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
 # endif
 _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wmemset);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wmemset
 # if HAVE_RAW_DECL_WMEMSET
@@ -574,7 +598,9 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
 _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcslen);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcslen
 # if HAVE_RAW_DECL_WCSLEN
@@ -607,7 +633,9 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
 _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
 # endif
 _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcscpy);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcscpy
 # if HAVE_RAW_DECL_WCSCPY
@@ -641,7 +669,9 @@ _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
 # endif
 _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
                   (wchar_t *dest, const wchar_t *src, size_t n));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsncpy);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsncpy
 # if HAVE_RAW_DECL_WCSNCPY
@@ -676,7 +706,9 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
 _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
 # endif
 _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcscat);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcscat
 # if HAVE_RAW_DECL_WCSCAT
@@ -694,7 +726,9 @@ _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
 # endif
 _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
                   (wchar_t *dest, const wchar_t *src, size_t n));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsncat);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsncat
 # if HAVE_RAW_DECL_WCSNCAT
@@ -711,7 +745,9 @@ _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
                                _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcscmp);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcscmp
 # if HAVE_RAW_DECL_WCSCMP
@@ -730,7 +766,9 @@ _GL_FUNCDECL_SYS (wcsncmp, int,
 # endif
 _GL_CXXALIAS_SYS (wcsncmp, int,
                   (const wchar_t *s1, const wchar_t *s2, size_t n));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsncmp);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsncmp
 # if HAVE_RAW_DECL_WCSNCMP
@@ -783,7 +821,9 @@ _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
 _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
 # endif
 _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcscoll);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcscoll
 # if HAVE_RAW_DECL_WCSCOLL
@@ -801,7 +841,9 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
 _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
 # endif
 _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsxfrm);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsxfrm
 # if HAVE_RAW_DECL_WCSXFRM
@@ -845,7 +887,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcschr,
      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
 _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
 _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
-# else
+# elif __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcschr);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -875,7 +917,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
 _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
 _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
-# else
+# elif __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsrchr);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -895,7 +937,9 @@ _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
                                    _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcscspn);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcscspn
 # if HAVE_RAW_DECL_WCSCSPN
@@ -913,7 +957,9 @@ _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
                                   _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsspn);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsspn
 # if HAVE_RAW_DECL_WCSSPN
@@ -944,7 +990,7 @@ _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
                    (wchar_t *wcs, const wchar_t *accept));
 _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
                    (const wchar_t *wcs, const wchar_t *accept));
-# else
+# elif __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcspbrk);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -977,7 +1023,7 @@ _GL_CXXALIASWARN1 (wcsstr, wchar_t *,
                    (wchar_t *haystack, const wchar_t *needle));
 _GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
                    (const wchar_t *haystack, const wchar_t *needle));
-# else
+# elif __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsstr);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -997,7 +1043,9 @@ _GL_FUNCDECL_SYS (wcstok, wchar_t *,
 # endif
 _GL_CXXALIAS_SYS (wcstok, wchar_t *,
                   (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcstok);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcstok
 # if HAVE_RAW_DECL_WCSTOK
@@ -1057,7 +1105,9 @@ _GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize,
 _GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize,
                                      const wchar_t *__fmt, const struct tm *__tp));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsftime);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsftime
 # if HAVE_RAW_DECL_WCSFTIME
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index 1a04742..4e57961 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -558,7 +558,9 @@ _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
 # else
 _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (iswblank);
+# endif
 #endif
 
 #if !@HAVE_WCTYPE_T@
@@ -623,7 +625,9 @@ typedef void * wctrans_t;
 _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name));
 # endif
 _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wctrans);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctrans
 # if HAVE_RAW_DECL_WCTRANS
@@ -640,7 +644,9 @@ _GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
 _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
 # endif
 _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (towctrans);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef towctrans
 # if HAVE_RAW_DECL_TOWCTRANS
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Compile error with GNULIB_NAMESPACE on Solaris (stdio.h)
  2019-11-21 10:53 ` Bruno Haible
@ 2019-11-21 22:41   ` Christian Biesinger
  2019-12-04  3:53   ` Bruno Haible
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Biesinger @ 2019-11-21 22:41 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

On Thu, Nov 21, 2019 at 4:53 AM Bruno Haible <bruno@clisp.org> wrote:
>
> Hi Christian,
>
> > I got a compile error with Gnulib on Solaris 11 / gcc:
> >
> > $ cat test.cc
> > #define GNULIB_NAMESPACE gnulib
> > #include "gnulib/config.h"
> > #include "stdio.h"
> >
> > $ g++ test.cc -I gnulib/import/ -I ../gnulib/import/
> > gnulib/import/stdio.h:1717:1: error: ‘int vfprintf(std::FILE*, const
> > char*, __va_list)’ conflicts with a previous declaration
> >  _GL_CXXALIASWARN (vfprintf);
> >  ^
> > In file included from
> > /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/include-fixed/stdio.h:75:0,
> >                  from gnulib/import/stdio.h:43,
> >                  from test.cc:3:
> > /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/include-fixed/iso/stdio_iso.h:223:12:
> > note: previous declaration ‘int std::vfprintf(std::FILE*, const char*,
> > __va_list)’
> >  extern int vfprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
> >             ^
> > In file included from /usr/include/sys/time.h:480:0,
> >                  from gnulib/import/sys/time.h:39,
> >                  from /usr/include/sys/select.h:28,
> >                  from /usr/include/sys/types.h:664,
> >                  from gnulib/import/sys/types.h:39,
> >                  from gnulib/import/stdio.h:58,
> >                  from test.cc:3:
> >
> > And lots of other functions.
>
> This should be fixed by the attached patches.
>
> To investigate this,
> - I created a testdir
>   $ ./gnulib-tool --create-testdir --dir=/tmp/testdir --single-configure --with-c++-tests `./posix-modules`
> - built it,
> - ran
>   $ make -k
> - ran
>   $ make -k 2>&1 | tee log4
> and collected the resulting log files on various platforms.
>
> A consequence of these patches is that _GL_CXXALIASWARN can only work
> reliably on glibc platforms. On other platforms, I had to disable it
> on 112 functions.

Thank you, this does work on Solaris for me now.

Christian

> 2019-11-21  Bruno Haible  <bruno@clisp.org>
>
>         pthread-mutex: Fix errors in C++ mode.
>         * m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Test whether
>         pthread_mutexattr_getrobust exists. If not, define
>         PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
>         * lib/pthread-mutex.c (pthread_mutexattr_getrobust,
>         pthread_mutexattr_setrobust): Define also if <pthread.h> exists but
>         PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
>         * modules/pthread-mutex (configure.ac): Compile pthread-mutex.c also
>         when <pthread.h> exists but pthread_mutexattr_getrobust needs a gnulib
>         definition.
>
> 2019-11-21  Bruno Haible  <bruno@clisp.org>
>
>         pthread-spin: Fix errors in C++ mode.
>         * m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Mark the pthread_spin_*
>         functions as nonexistent when <pthread.h> exists but does not define
>         the pthread_spinlock_t type.
>
> 2019-11-21  Bruno Haible  <bruno@clisp.org>
>
>         math tests: Update after 2019-08-28 change.
>         * tests/test-math-c++.cc (isfinite, isinf, isnan, signbit): Expect a
>         return type of 'bool', not 'int'.
>
> 2019-11-21  Bruno Haible  <bruno@clisp.org>
>
>         Fix various errors in _GL_CXXALIAS_SYS invocations.
>         * lib/locale.in.h (freelocale): Use _GL_CXXALIAS_SYS_CAST instead of
>         _GL_CXXALIAS_SYS.
>         * lib/pthread.in.h (pthread_mutexattr_gettype,
>         pthread_mutexattr_getrobust): Likewise.
>         * lib/stdlib.in.h (srandom, initstate, setstate): Likewise.
>         * lib/sys_socket.in.h (recv, send): Likewise.
>         * lib/unistd.in.h (getdtablesize): Likewise.
>         * lib/sys_select.in.h (select): In C++, write 'timeval' instead of
>         'struct timeval'.
>
> 2019-11-21  Bruno Haible  <bruno@clisp.org>
>
>         Disable many _GL_CXXALIASWARN on all platforms other than glibc systems.
>         Reported by Christian Biesinger <cbiesinger@google.com> in
>         <https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00066.html>.
>         * lib/fnmatch.in.h (fnmatch): Disable _GL_CXXALIASWARN invocation on
>         non-glibc systems.
>         * lib/locale.in.h (localeconv, setlocale): Likewise.
>         * lib/math.in.h (cbrt, ceil, copysign, exp2, expm1, floor, fma, fmod,
>         frexp, hypot, ilogb, log, log10, log1p, log2, logb, modf, remainder,
>         rint, round, trunc): Likewise.
>         * lib/monetary.in.h (strfmon_l): Likewise.
>         * lib/pthread.in.h (pthread_mutexattr_getrobust,
>         pthread_mutexattr_setrobust, pthread_mutex_lock, pthread_spin_init,
>         pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock,
>         pthread_spin_destroy): Likewise.
>         * lib/signal.in.h (raise, signal): Likewise.
>         * lib/stdio.in.h (fclose, fflush, fgetc, fgets, fopen, fprintf, fputc,
>         fputs, fread, freopen, fscanf, fseek, ftell, fwrite, getc, getchar,
>         perror, printf, putc, putchar, puts, remove, rename, scanf, sprintf,
>         tmpfile, vfprintf, vprintf, vsprintf): Likewise.
>         * lib/stdlib.in.h (calloc, malloc, mbtowc, realloc, strtod, wctomb):
>         Likewise.
>         * lib/string.in.h (memchr, strncat, strpbrk, strstr, strerror):
>         Likewise.
>         * lib/time.in.h (mktime, localtime, ctime, strftime): Likewise.
>         * lib/wchar.in.h (btowc, wctob, mbsinit, mbrtowc, mbrlen, mbsrtowcs,
>         wcrtomb, wcsrtombs, wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset,
>         wcslen, wcscpy, wcsncpy, wcscat, wcsncat, wcscmp, wcsncmp, wcscoll,
>         wcsxfrm, wcschr, wcsrchr, wcscspn, wcsspn, wcspbrk, wcsstr, wcstok,
>         wcsftime): Likewise.
>         * lib/wctype.in.h (iswblank, wctrans, towctrans): Likewise.
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compile error with GNULIB_NAMESPACE on Solaris (stdio.h)
  2019-11-21 10:53 ` Bruno Haible
  2019-11-21 22:41   ` Christian Biesinger
@ 2019-12-04  3:53   ` Bruno Haible
  1 sibling, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2019-12-04  3:53 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Christian Biesinger

> 2019-11-21  Bruno Haible  <bruno@clisp.org>
> 
> 	Disable many _GL_CXXALIASWARN on all platforms other than glibc systems.

Some more of this, this time needed for Solaris OpenIndiana.


2019-12-04  Bruno Haible  <bruno@clisp.org>

	Disable more _GL_CXXALIASWARN on all platforms other than glibc systems.
	* lib/wchar.in.h (wcsnrtombs, wcwidth, wcswidth): Disable
	_GL_CXXALIASWARN invocation on non-glibc systems.
	* lib/wctype.in.h (iswalnum, iswalpha, iswcntrl, iswdigit, iswgraph,
	iswlower, iswprint, iswpunct, iswspace, iswupper, iswxdigit, wctype,
	iswctype, towlower, towupper): Likewise.

diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 043a592..f081be6 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -446,7 +446,9 @@ _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
                   (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
                    mbstate_t *ps));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcsnrtombs);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
 # if HAVE_RAW_DECL_WCSNRTOMBS
@@ -472,7 +474,9 @@ _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
 #  endif
 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcwidth);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
 # if HAVE_RAW_DECL_WCWIDTH
@@ -1085,7 +1089,9 @@ _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
 #  endif
 _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wcswidth);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcswidth
 # if HAVE_RAW_DECL_WCSWIDTH
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index b3edb0d..cb45302 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -540,6 +540,7 @@ _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
 _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
 _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
 #endif
+#if __GLIBC__ >= 2
 _GL_CXXALIASWARN (iswalnum);
 _GL_CXXALIASWARN (iswalpha);
 _GL_CXXALIASWARN (iswcntrl);
@@ -551,6 +552,7 @@ _GL_CXXALIASWARN (iswpunct);
 _GL_CXXALIASWARN (iswspace);
 _GL_CXXALIASWARN (iswupper);
 _GL_CXXALIASWARN (iswxdigit);
+#endif
 
 #if @GNULIB_ISWBLANK@
 # if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@
@@ -576,7 +578,9 @@ typedef void * wctype_t;
 _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name));
 # endif
 _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (wctype);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctype
 # if HAVE_RAW_DECL_WCTYPE
@@ -602,7 +606,9 @@ _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
 #  endif
 _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (iswctype);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef iswctype
 # if HAVE_RAW_DECL_ISWCTYPE
@@ -618,8 +624,10 @@ _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
 _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
 _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
 #endif
+#if __GLIBC__ >= 2
 _GL_CXXALIASWARN (towlower);
 _GL_CXXALIASWARN (towupper);
+#endif
 
 #if !@HAVE_WCTRANS_T@
 # if !GNULIB_defined_wctrans_t



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-04  3:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 19:57 Compile error with GNULIB_NAMESPACE on Solaris (stdio.h) Christian Biesinger
2019-11-21 10:53 ` Bruno Haible
2019-11-21 22:41   ` Christian Biesinger
2019-12-04  3:53   ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).