diff --git a/lib/c++defs.h b/lib/c++defs.h index b77979a3259..b887cc3fb80 100644 --- a/lib/c++defs.h +++ b/lib/c++defs.h @@ -127,6 +127,16 @@ #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters +/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to + parenthesized func otherwise. Parenthesization is needed in C23 if + the function is like strchr and so is a qualifier-generic macro + that expands to something more complicated. */ +#ifdef __cplusplus +# define _GL_FUNCDECL_SYS_NAME(func) func +#else +# define _GL_FUNCDECL_SYS_NAME(func) (func) +#endif + /* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. @@ -139,7 +149,7 @@ _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); */ #define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ - _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func diff --git a/lib/dirent.in.h b/lib/dirent.in.h index e6c59e5a41d..2fa347f1d16 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -173,7 +173,6 @@ _GL_CXXALIAS_SYS (closedir, int, (DIR *dirp)); # endif _GL_CXXALIASWARN (closedir); #elif defined GNULIB_POSIXCHECK -# undef closedir # if HAVE_RAW_DECL_CLOSEDIR _GL_WARN_ON_USE (closedir, "closedir is not portable - " "use gnulib module closedir for portability"); @@ -213,7 +212,6 @@ _GL_FUNCDECL_SYS (opendir, DIR *, _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif # if defined GNULIB_POSIXCHECK -# undef opendir # if HAVE_RAW_DECL_OPENDIR _GL_WARN_ON_USE (opendir, "opendir is not portable - " "use gnulib module opendir for portability"); @@ -237,7 +235,6 @@ _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp)); # endif _GL_CXXALIASWARN (readdir); #elif defined GNULIB_POSIXCHECK -# undef readdir # if HAVE_RAW_DECL_READDIR _GL_WARN_ON_USE (readdir, "readdir is not portable - " "use gnulib module readdir for portability"); @@ -260,7 +257,6 @@ _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp)); # endif _GL_CXXALIASWARN (rewinddir); #elif defined GNULIB_POSIXCHECK -# undef rewinddir # if HAVE_RAW_DECL_REWINDDIR _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - " "use gnulib module rewinddir for portability"); @@ -293,7 +289,6 @@ _GL_CXXALIAS_SYS (dirfd, int, (DIR *)); # endif _GL_CXXALIASWARN (dirfd); #elif defined GNULIB_POSIXCHECK -# undef dirfd # if HAVE_RAW_DECL_DIRFD _GL_WARN_ON_USE (dirfd, "dirfd is unportable - " "use gnulib module dirfd for portability"); @@ -335,7 +330,6 @@ _GL_FUNCDECL_SYS (fdopendir, DIR *, _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif # if defined GNULIB_POSIXCHECK -# undef fdopendir # if HAVE_RAW_DECL_FDOPENDIR _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - " "use gnulib module fdopendir for portability"); @@ -363,7 +357,6 @@ _GL_CXXALIAS_SYS_CAST (scandir, int, int (*cmp) (const struct dirent **, const struct dirent **))); _GL_CXXALIASWARN (scandir); #elif defined GNULIB_POSIXCHECK -# undef scandir # if HAVE_RAW_DECL_SCANDIR _GL_WARN_ON_USE (scandir, "scandir is unportable - " "use gnulib module scandir for portability"); @@ -384,7 +377,6 @@ _GL_CXXALIAS_SYS_CAST (alphasort, int, (const struct dirent **, const struct dirent **)); _GL_CXXALIASWARN (alphasort); #elif defined GNULIB_POSIXCHECK -# undef alphasort # if HAVE_RAW_DECL_ALPHASORT _GL_WARN_ON_USE (alphasort, "alphasort is unportable - " "use gnulib module alphasort for portability"); diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index bcb5606b13e..a27cc4620e0 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -122,7 +122,6 @@ _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); # endif _GL_CXXALIASWARN (creat); #elif defined GNULIB_POSIXCHECK -# undef creat /* Assume creat is always declared. */ _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " "use gnulib module creat for portability"); @@ -165,7 +164,6 @@ _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); # endif _GL_CXXALIASWARN (fcntl); #elif defined GNULIB_POSIXCHECK -# undef fcntl # if HAVE_RAW_DECL_FCNTL _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " "use gnulib module fcntl for portability"); @@ -196,7 +194,6 @@ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); _GL_CXXALIASWARN (open); # endif #elif defined GNULIB_POSIXCHECK -# undef open /* Assume open is always declared. */ _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " "use gnulib module open for portability"); @@ -242,7 +239,6 @@ _GL_CXXALIAS_SYS (openat, int, # endif _GL_CXXALIASWARN (openat); #elif defined GNULIB_POSIXCHECK -# undef openat # if HAVE_RAW_DECL_OPENAT _GL_WARN_ON_USE (openat, "openat is not portable - " "use gnulib module openat for portability"); @@ -283,7 +279,6 @@ _GL_CXXALIAS_SYS (openat2, int, size_t size)); _GL_CXXALIASWARN (openat2); #elif defined GNULIB_POSIXCHECK -# undef openat2 # if HAVE_RAW_DECL_OPENAT2 _GL_WARN_ON_USE (openat2, "openat2 is not portable - " "use gnulib module openat2 for portability"); diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index 5520ebc5699..26d4b27b834 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -925,7 +925,6 @@ _GL_CXXALIAS_SYS (imaxabs, intmax_t, (intmax_t x)); _GL_CXXALIASWARN (imaxabs); # endif #elif defined GNULIB_POSIXCHECK -# undef imaxabs # if HAVE_RAW_DECL_IMAXABS _GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - " "use gnulib module imaxabs for portability"); @@ -956,7 +955,6 @@ _GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); _GL_CXXALIASWARN (imaxdiv); # endif #elif defined GNULIB_POSIXCHECK -# undef imaxdiv # if HAVE_RAW_DECL_IMAXDIV _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " "use gnulib module imaxdiv for portability"); @@ -986,7 +984,6 @@ _GL_CXXALIAS_SYS (strtoimax, intmax_t, # endif _GL_CXXALIASWARN (strtoimax); #elif defined GNULIB_POSIXCHECK -# undef strtoimax # if HAVE_RAW_DECL_STRTOIMAX _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " "use gnulib module strtoimax for portability"); @@ -1016,7 +1013,6 @@ _GL_CXXALIAS_SYS (strtoumax, uintmax_t, # endif _GL_CXXALIASWARN (strtoumax); #elif defined GNULIB_POSIXCHECK -# undef strtoumax # if HAVE_RAW_DECL_STRTOUMAX _GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - " "use gnulib module strtoumax for portability"); diff --git a/lib/signal.in.h b/lib/signal.in.h index 66e0c310ef8..45556dbbc4f 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -156,7 +156,6 @@ _GL_CXXALIAS_SYS (sig2str, int, (int signo, char *str)); _GL_CXXALIASWARN (sig2str); # endif #elif defined GNULIB_POSIXCHECK -# undef sig2str # if HAVE_RAW_DECL_SIG2STR _GL_WARN_ON_USE (sig2str, "sig2str is not portable - " "use gnulib module sig2str for portability"); @@ -172,7 +171,6 @@ _GL_CXXALIAS_SYS (str2sig, int, (char const *str, int *signo_p)); _GL_CXXALIASWARN (str2sig); # endif #elif defined GNULIB_POSIXCHECK -# undef str2sig # if HAVE_RAW_DECL_STR2SIG _GL_WARN_ON_USE (str2sig, "str2sig is not portable - " "use gnulib module sig2str for portability"); @@ -210,7 +208,6 @@ _GL_CXXALIAS_SYS (pthread_sigmask, int, _GL_CXXALIASWARN (pthread_sigmask); # endif #elif defined GNULIB_POSIXCHECK -# undef pthread_sigmask # if HAVE_RAW_DECL_PTHREAD_SIGMASK _GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " "use gnulib module pthread_sigmask for portability"); @@ -236,7 +233,6 @@ _GL_CXXALIAS_SYS (raise, int, (int sig)); _GL_CXXALIASWARN (raise); # endif #elif defined GNULIB_POSIXCHECK -# undef raise /* Assume raise is always declared. */ _GL_WARN_ON_USE (raise, "raise can crash on native Windows - " "use gnulib module raise for portability"); @@ -407,37 +403,30 @@ _GL_EXTERN_C int _gl_raise_SIGPIPE (void); # endif #elif defined GNULIB_POSIXCHECK -# undef sigaddset # if HAVE_RAW_DECL_SIGADDSET _GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigdelset # if HAVE_RAW_DECL_SIGDELSET _GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigemptyset # if HAVE_RAW_DECL_SIGEMPTYSET _GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigfillset # if HAVE_RAW_DECL_SIGFILLSET _GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigismember # if HAVE_RAW_DECL_SIGISMEMBER _GL_WARN_ON_USE (sigismember, "sigismember is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigpending # if HAVE_RAW_DECL_SIGPENDING _GL_WARN_ON_USE (sigpending, "sigpending is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigprocmask # if HAVE_RAW_DECL_SIGPROCMASK _GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - " "use the gnulib module sigprocmask for portability"); @@ -523,7 +512,6 @@ _GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict, _GL_CXXALIASWARN (sigaction); #elif defined GNULIB_POSIXCHECK -# undef sigaction # if HAVE_RAW_DECL_SIGACTION _GL_WARN_ON_USE (sigaction, "sigaction is unportable - " "use the gnulib module sigaction for portability"); diff --git a/lib/stdio.in.h b/lib/stdio.in.h index cc6010119d0..c2af4f6dffc 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -338,7 +338,7 @@ _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); _GL_CXXALIASWARN (dprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef dprintf +# undef dprintf /* https://lists.gnu.org/r/bug-gnulib/2025-11/msg00254.html */ # if HAVE_RAW_DECL_DPRINTF _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " "use gnulib module dprintf for portability"); @@ -360,7 +360,6 @@ _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); _GL_CXXALIASWARN (fclose); # endif #elif defined GNULIB_POSIXCHECK -# undef fclose /* Assume fclose is always declared. */ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " "use gnulib module fclose for portable POSIX compliance"); @@ -447,7 +446,6 @@ _GL_FUNCDECL_SYS (fdopen, FILE *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef fdopen /* Assume fdopen is always declared. */ _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " "use gnulib module fdopen for portability"); @@ -488,7 +486,6 @@ _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); _GL_CXXALIASWARN (fflush); # endif #elif defined GNULIB_POSIXCHECK -# undef fflush /* Assume fflush is always declared. */ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " "use gnulib module fflush for portable POSIX compliance"); @@ -581,7 +578,6 @@ _GL_FUNCDECL_SYS (fopen, FILE *, _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif # if defined GNULIB_POSIXCHECK -# undef fopen /* Assume fopen is always declared. */ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " "use gnulib module fopen for portability"); @@ -641,9 +637,6 @@ _GL_CXXALIASWARN (fprintf); # endif #endif #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_fprintf -# undef fprintf -# endif /* Assume fprintf is always declared. */ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " "use gnulib module fprintf-posix for portable " @@ -673,7 +666,6 @@ _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); _GL_CXXALIASWARN (fpurge); # endif #elif defined GNULIB_POSIXCHECK -# undef fpurge # if HAVE_RAW_DECL_FPURGE _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " "use gnulib module fpurge for portability"); @@ -761,7 +753,6 @@ _GL_CXXALIAS_SYS (freopen, FILE *, _GL_CXXALIASWARN (freopen); # endif #elif defined GNULIB_POSIXCHECK -# undef freopen /* Assume freopen is always declared. */ _GL_WARN_ON_USE (freopen, "freopen on native Windows platforms is not POSIX compliant - " @@ -868,7 +859,6 @@ _GL_CXXALIASWARN (fseeko); #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ # undef fseek -# undef fseeko # if HAVE_RAW_DECL_FSEEKO _GL_WARN_ON_USE (fseeko, "fseeko is unportable - " "use gnulib module fseeko for portability"); @@ -932,7 +922,6 @@ _GL_CXXALIASWARN (ftello); #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ # undef ftell -# undef ftello # if HAVE_RAW_DECL_FTELLO _GL_WARN_ON_USE (ftello, "ftello is unportable - " "use gnulib module ftello for portability"); @@ -1081,7 +1070,6 @@ _GL_CXXALIAS_SYS (getdelim, ssize_t, _GL_CXXALIASWARN (getdelim); # endif #elif defined GNULIB_POSIXCHECK -# undef getdelim # if HAVE_RAW_DECL_GETDELIM _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " "use gnulib module getdelim for portability"); @@ -1135,7 +1123,6 @@ _GL_CXXALIAS_SYS (getline, ssize_t, _GL_CXXALIASWARN (getline); # endif #elif defined GNULIB_POSIXCHECK -# undef getline # if HAVE_RAW_DECL_GETLINE _GL_WARN_ON_USE (getline, "getline is unportable - " "use gnulib module getline for portability"); @@ -1145,7 +1132,6 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " /* It is very rare that the developer ever has full control of stdin, so any use of gets warrants an unconditional warning; besides, C11 removed it. */ -#undef gets #if HAVE_RAW_DECL_GETS && !defined __cplusplus _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); #endif @@ -1258,7 +1244,6 @@ _GL_FUNCDECL_SYS (pclose, int, (FILE *stream), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); _GL_CXXALIASWARN (pclose); #elif defined GNULIB_POSIXCHECK -# undef pclose # if HAVE_RAW_DECL_PCLOSE _GL_WARN_ON_USE (pclose, "pclose is unportable - " "use gnulib module pclose for more portability"); @@ -1282,7 +1267,6 @@ _GL_CXXALIAS_SYS (perror, void, (const char *string)); _GL_CXXALIASWARN (perror); # endif #elif defined GNULIB_POSIXCHECK -# undef perror /* Assume perror is always declared. */ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " "use gnulib module perror for portability"); @@ -1319,7 +1303,6 @@ _GL_FUNCDECL_SYS (popen, FILE *, _GL_ATTRIBUTE_MALLOC); # endif # if defined GNULIB_POSIXCHECK -# undef popen # if HAVE_RAW_DECL_POPEN _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " "use gnulib module popen or pipe for more portability"); @@ -1392,9 +1375,6 @@ _GL_CXXALIASWARN (printf); # endif #endif #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_printf -# undef printf -# endif /* Assume printf is always declared. */ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " "use gnulib module printf-posix for portable " @@ -1488,7 +1468,6 @@ _GL_CXXALIAS_SYS (remove, int, (const char *name)); _GL_CXXALIASWARN (remove); # endif #elif defined GNULIB_POSIXCHECK -# undef remove /* Assume remove is always declared. */ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " "use gnulib module remove for more portability"); @@ -1513,7 +1492,6 @@ _GL_CXXALIAS_SYS (rename, int, _GL_CXXALIASWARN (rename); # endif #elif defined GNULIB_POSIXCHECK -# undef rename /* Assume rename is always declared. */ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " "use gnulib module rename for more portability"); @@ -1541,7 +1519,6 @@ _GL_CXXALIAS_SYS (renameat, int, # endif _GL_CXXALIASWARN (renameat); #elif defined GNULIB_POSIXCHECK -# undef renameat # if HAVE_RAW_DECL_RENAMEAT _GL_WARN_ON_USE (renameat, "renameat is not portable - " "use gnulib module renameat for portability"); @@ -1635,7 +1612,6 @@ _GL_CXXALIAS_SYS (snprintf, int, _GL_CXXALIASWARN (snprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef snprintf # if HAVE_RAW_DECL_SNPRINTF _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " "use gnulib module snprintf for portability"); @@ -1691,7 +1667,6 @@ _GL_CXXALIAS_SYS (sprintf, int, _GL_CXXALIASWARN (sprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef sprintf /* Assume sprintf is always declared. */ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " "use gnulib module sprintf-posix for portable " @@ -1746,7 +1721,6 @@ _GL_FUNCDECL_SYS (tmpfile, FILE *, (void), _GL_ATTRIBUTE_MALLOC); # endif # if defined GNULIB_POSIXCHECK -# undef tmpfile # if HAVE_RAW_DECL_TMPFILE _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " "use gnulib module tmpfile for portability"); @@ -1880,7 +1854,6 @@ _GL_CXXALIAS_SYS_CAST (vdprintf, int, _GL_CXXALIASWARN (vdprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vdprintf # if HAVE_RAW_DECL_VDPRINTF _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " "use gnulib module vdprintf for portability"); @@ -1949,9 +1922,6 @@ _GL_CXXALIASWARN (vfprintf); # endif #endif #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_vfprintf -# undef vfprintf -# endif /* Assume vfprintf is always declared. */ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " "use gnulib module vfprintf-posix for portable " @@ -2035,9 +2005,6 @@ _GL_CXXALIASWARN (vprintf); # endif #endif #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_vprintf -# undef vprintf -# endif /* Assume vprintf is always declared. */ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " "use gnulib module vprintf-posix for portable " @@ -2116,7 +2083,6 @@ _GL_CXXALIAS_SYS (vsnprintf, int, _GL_CXXALIASWARN (vsnprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vsnprintf # if HAVE_RAW_DECL_VSNPRINTF _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " "use gnulib module vsnprintf for portability"); @@ -2169,7 +2135,6 @@ _GL_CXXALIAS_SYS_CAST (vsprintf, int, _GL_CXXALIASWARN (vsprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vsprintf /* Assume vsprintf is always declared. */ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " "use gnulib module vsprintf-posix for portable " diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index bef0aaaf92e..b5ad275e5d6 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -224,9 +224,9 @@ _GL_INLINE_HEADER_BEGIN /* Declarations for ISO C N3322. */ #if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ -_GL_EXTERN_C void *bsearch (const void *__key, - const void *__base, size_t __nmemb, size_t __size, - int (*__compare) (const void *, const void *)) +_GL_EXTERN_C void *_GL_FUNCDECL_SYS_NAME (bsearch) + (const void *__key, const void *__base, size_t __nmemb, size_t __size, + int (*__compare) (const void *, const void *)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5)); _GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size, int (*__compare) (const void *, const void *)) @@ -254,7 +254,6 @@ _GL_CXXALIAS_SYS (_Exit, void, (int status)); _GL_CXXALIASWARN (_Exit); # endif #elif defined GNULIB_POSIXCHECK -# undef _Exit # if HAVE_RAW_DECL__EXIT _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " "use gnulib module _Exit for portability"); @@ -301,7 +300,6 @@ _GL_CXXALIAS_SYS (free, void, (void *ptr)); _GL_CXXALIASWARN (free); # endif #elif defined GNULIB_POSIXCHECK -# undef free /* Assume free is always declared. */ _GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - " "use gnulib module free-posix for portability"); @@ -359,7 +357,6 @@ _GL_FUNCDECL_SYS (aligned_alloc, void *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef aligned_alloc # if HAVE_RAW_DECL_ALIGNED_ALLOC _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " "use gnulib module aligned_alloc for portability"); @@ -379,7 +376,6 @@ _GL_FUNCDECL_SYS (atoll, long long, _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); _GL_CXXALIASWARN (atoll); #elif defined GNULIB_POSIXCHECK -# undef atoll # if HAVE_RAW_DECL_ATOLL _GL_WARN_ON_USE (atoll, "atoll is unportable - " "use gnulib module atoll for portability"); @@ -436,7 +432,6 @@ _GL_FUNCDECL_SYS (calloc, void *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef calloc /* Assume calloc is always declared. */ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " "use gnulib module calloc-posix for portability"); @@ -497,7 +492,6 @@ _GL_FUNCDECL_SYS (canonicalize_file_name, char *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef canonicalize_file_name # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME _GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - " @@ -597,7 +591,6 @@ _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); _GL_CXXALIASWARN (getloadavg); # endif #elif defined GNULIB_POSIXCHECK -# undef getloadavg # if HAVE_RAW_DECL_GETLOADAVG _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " "use gnulib module getloadavg for portability"); @@ -632,7 +625,6 @@ _GL_CXXALIAS_SYS (getprogname, const char *, (void)); _GL_CXXALIASWARN (getprogname); # endif #elif defined GNULIB_POSIXCHECK -# undef getprogname # if HAVE_RAW_DECL_GETPROGNAME _GL_WARN_ON_USE (getprogname, "getprogname is unportable - " "use gnulib module getprogname for portability"); @@ -674,7 +666,6 @@ _GL_CXXALIAS_SYS (getsubopt, int, _GL_CXXALIASWARN (getsubopt); # endif #elif defined GNULIB_POSIXCHECK -# undef getsubopt # if HAVE_RAW_DECL_GETSUBOPT _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " "use gnulib module getsubopt for portability"); @@ -690,7 +681,6 @@ _GL_FUNCDECL_SYS (grantpt, int, (int fd), ); _GL_CXXALIAS_SYS (grantpt, int, (int fd)); _GL_CXXALIASWARN (grantpt); #elif defined GNULIB_POSIXCHECK -# undef grantpt # if HAVE_RAW_DECL_GRANTPT _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " "use gnulib module grantpt for portability"); @@ -751,7 +741,6 @@ _GL_FUNCDECL_SYS (malloc, void *, # endif # endif # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC -# undef malloc /* Assume malloc is always declared. */ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " "use gnulib module malloc-posix for portability"); @@ -802,7 +791,6 @@ _GL_CXXALIAS_SYS (mbstowcs, size_t, _GL_CXXALIASWARN (mbstowcs); # endif #elif defined GNULIB_POSIXCHECK -# undef mbstowcs # if HAVE_RAW_DECL_MBSTOWCS _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - " "use gnulib module mbstowcs for portability"); @@ -832,7 +820,6 @@ _GL_CXXALIAS_SYS (mbtowc, int, _GL_CXXALIASWARN (mbtowc); # endif #elif defined GNULIB_POSIXCHECK -# undef mbtowc # if HAVE_RAW_DECL_MBTOWC _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " "use gnulib module mbtowc for portability"); @@ -853,7 +840,6 @@ _GL_FUNCDECL_SYS (mkdtemp, char *, _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); _GL_CXXALIASWARN (mkdtemp); #elif defined GNULIB_POSIXCHECK -# undef mkdtemp # if HAVE_RAW_DECL_MKDTEMP _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " "use gnulib module mkdtemp for portability"); @@ -892,7 +878,6 @@ _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); _GL_CXXALIASWARN (mkostemp); # endif #elif defined GNULIB_POSIXCHECK -# undef mkostemp # if HAVE_RAW_DECL_MKOSTEMP _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " "use gnulib module mkostemp for portability"); @@ -936,7 +921,6 @@ _GL_CXXALIAS_SYS (mkostemps, int, _GL_CXXALIASWARN (mkostemps); # endif #elif defined GNULIB_POSIXCHECK -# undef mkostemps # if HAVE_RAW_DECL_MKOSTEMPS _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " "use gnulib module mkostemps for portability"); @@ -969,7 +953,6 @@ _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); # endif _GL_CXXALIASWARN (mkstemp); #elif defined GNULIB_POSIXCHECK -# undef mkstemp # if HAVE_RAW_DECL_MKSTEMP _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " "use gnulib module mkstemp for portability"); @@ -994,7 +977,6 @@ _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/), _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); _GL_CXXALIASWARN (mkstemps); #elif defined GNULIB_POSIXCHECK -# undef mkstemps # if HAVE_RAW_DECL_MKSTEMPS _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " "use gnulib module mkstemps for portability"); @@ -1039,7 +1021,6 @@ _GL_CXXALIAS_SYS (posix_memalign, int, _GL_CXXALIASWARN (posix_memalign); # endif #elif defined GNULIB_POSIXCHECK -# undef posix_memalign # if HAVE_RAW_DECL_POSIX_MEMALIGN _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " "use gnulib module posix_memalign for portability"); @@ -1066,7 +1047,6 @@ _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); _GL_CXXALIASWARN (posix_openpt); # endif #elif defined GNULIB_POSIXCHECK -# undef posix_openpt # if HAVE_RAW_DECL_POSIX_OPENPT _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " "use gnulib module posix_openpt for portability"); @@ -1091,7 +1071,6 @@ _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); # endif _GL_CXXALIASWARN (ptsname); #elif defined GNULIB_POSIXCHECK -# undef ptsname # if HAVE_RAW_DECL_PTSNAME _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " "use gnulib module ptsname for portability"); @@ -1120,7 +1099,6 @@ _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); # endif _GL_CXXALIASWARN (ptsname_r); #elif defined GNULIB_POSIXCHECK -# undef ptsname_r # if HAVE_RAW_DECL_PTSNAME_R _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " "use gnulib module ptsname_r for portability"); @@ -1214,7 +1192,6 @@ _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, _GL_CXXALIASWARN (qsort_r); # endif #elif defined GNULIB_POSIXCHECK -# undef qsort_r # if HAVE_RAW_DECL_QSORT_R _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " "use gnulib module qsort_r for portability"); @@ -1266,7 +1243,6 @@ _GL_CXXALIAS_SYS_CAST (random, long, (void)); _GL_CXXALIASWARN (random); # endif #elif defined GNULIB_POSIXCHECK -# undef random # if HAVE_RAW_DECL_RANDOM _GL_WARN_ON_USE (random, "random is unportable - " "use gnulib module random for portability"); @@ -1293,7 +1269,6 @@ _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); _GL_CXXALIASWARN (srandom); # endif #elif defined GNULIB_POSIXCHECK -# undef srandom # if HAVE_RAW_DECL_SRANDOM _GL_WARN_ON_USE (srandom, "srandom is unportable - " "use gnulib module random for portability"); @@ -1326,7 +1301,6 @@ _GL_CXXALIAS_SYS_CAST (initstate, char *, _GL_CXXALIASWARN (initstate); # endif #elif defined GNULIB_POSIXCHECK -# undef initstate # if HAVE_RAW_DECL_INITSTATE _GL_WARN_ON_USE (initstate, "initstate is unportable - " "use gnulib module random for portability"); @@ -1353,7 +1327,6 @@ _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); _GL_CXXALIASWARN (setstate); # endif #elif defined GNULIB_POSIXCHECK -# undef setstate # if HAVE_RAW_DECL_SETSTATE _GL_WARN_ON_USE (setstate, "setstate is unportable - " "use gnulib module random for portability"); @@ -1379,7 +1352,6 @@ _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); # endif _GL_CXXALIASWARN (random_r); #elif defined GNULIB_POSIXCHECK -# undef random_r # if HAVE_RAW_DECL_RANDOM_R _GL_WARN_ON_USE (random_r, "random_r is unportable - " "use gnulib module random_r for portability"); @@ -1408,7 +1380,6 @@ _GL_CXXALIAS_SYS (srandom_r, int, # endif _GL_CXXALIASWARN (srandom_r); #elif defined GNULIB_POSIXCHECK -# undef srandom_r # if HAVE_RAW_DECL_SRANDOM_R _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " "use gnulib module random_r for portability"); @@ -1443,7 +1414,6 @@ _GL_CXXALIAS_SYS_CAST (initstate_r, int, # endif _GL_CXXALIASWARN (initstate_r); #elif defined GNULIB_POSIXCHECK -# undef initstate_r # if HAVE_RAW_DECL_INITSTATE_R _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " "use gnulib module random_r for portability"); @@ -1474,7 +1444,6 @@ _GL_CXXALIAS_SYS_CAST (setstate_r, int, # endif _GL_CXXALIASWARN (setstate_r); #elif defined GNULIB_POSIXCHECK -# undef setstate_r # if HAVE_RAW_DECL_SETSTATE_R _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " "use gnulib module random_r for portability"); @@ -1544,7 +1513,6 @@ _GL_FUNCDECL_SYS (realloc, void *, # endif # endif # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC -# undef realloc /* Assume realloc is always declared. */ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); @@ -1576,7 +1544,6 @@ _GL_CXXALIAS_SYS (reallocarray, void *, _GL_CXXALIASWARN (reallocarray); # endif #elif defined GNULIB_POSIXCHECK -# undef reallocarray # if HAVE_RAW_DECL_REALLOCARRAY _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " "use gnulib module reallocarray for portability"); @@ -1604,7 +1571,6 @@ _GL_CXXALIAS_SYS (realpath, char *, # endif _GL_CXXALIASWARN (realpath); #elif defined GNULIB_POSIXCHECK -# undef realpath # if HAVE_RAW_DECL_REALPATH _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " "canonicalize or canonicalize-lgpl for portability"); @@ -1621,7 +1587,6 @@ _GL_FUNCDECL_SYS (rpmatch, int, (const char *response), _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); _GL_CXXALIASWARN (rpmatch); #elif defined GNULIB_POSIXCHECK -# undef rpmatch # if HAVE_RAW_DECL_RPMATCH _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " "use gnulib module rpmatch for portability"); @@ -1638,7 +1603,6 @@ _GL_FUNCDECL_SYS (secure_getenv, char *, _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); _GL_CXXALIASWARN (secure_getenv); #elif defined GNULIB_POSIXCHECK -# undef secure_getenv # if HAVE_RAW_DECL_SECURE_GETENV _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " "use gnulib module secure_getenv for portability"); @@ -1671,7 +1635,6 @@ _GL_CXXALIAS_SYS (setenv, int, _GL_CXXALIASWARN (setenv); # endif #elif defined GNULIB_POSIXCHECK -# undef setenv # if HAVE_RAW_DECL_SETENV _GL_WARN_ON_USE (setenv, "setenv is unportable - " "use gnulib module setenv for portability"); @@ -1716,7 +1679,6 @@ _GL_CXXALIAS_SYS (strtod, double, _GL_CXXALIASWARN (strtod); # endif #elif defined GNULIB_POSIXCHECK -# undef strtod # if HAVE_RAW_DECL_STRTOD _GL_WARN_ON_USE (strtod, "strtod is unportable - " "use gnulib module strtod for portability"); @@ -1748,7 +1710,6 @@ _GL_CXXALIAS_SYS (strtof, float, _GL_CXXALIASWARN (strtof); # endif #elif defined GNULIB_POSIXCHECK -# undef strtof # if HAVE_RAW_DECL_STRTOF _GL_WARN_ON_USE (strtof, "strtof is unportable - " "use gnulib module strtof for portability"); @@ -1778,7 +1739,6 @@ _GL_CXXALIAS_SYS (strtold, long double, # endif _GL_CXXALIASWARN (strtold); #elif defined GNULIB_POSIXCHECK -# undef strtold # if HAVE_RAW_DECL_STRTOLD _GL_WARN_ON_USE (strtold, "strtold is unportable - " "use gnulib module strtold for portability"); @@ -1821,7 +1781,6 @@ _GL_CXXALIAS_SYS (strtol, long, _GL_CXXALIASWARN (strtol); # endif #elif defined GNULIB_POSIXCHECK -# undef strtol # if HAVE_RAW_DECL_STRTOL _GL_WARN_ON_USE (strtol, "strtol is unportable - " "use gnulib module strtol for portability"); @@ -1862,7 +1821,6 @@ _GL_CXXALIAS_SYS (strtoll, long long, # endif _GL_CXXALIASWARN (strtoll); #elif defined GNULIB_POSIXCHECK -# undef strtoll # if HAVE_RAW_DECL_STRTOLL _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " "use gnulib module strtoll for portability"); @@ -1904,7 +1862,6 @@ _GL_CXXALIAS_SYS (strtoul, unsigned long, _GL_CXXALIASWARN (strtoul); # endif #elif defined GNULIB_POSIXCHECK -# undef strtoul # if HAVE_RAW_DECL_STRTOUL _GL_WARN_ON_USE (strtoul, "strtoul is unportable - " "use gnulib module strtoul for portability"); @@ -1945,7 +1902,6 @@ _GL_CXXALIAS_SYS (strtoull, unsigned long long, # endif _GL_CXXALIASWARN (strtoull); #elif defined GNULIB_POSIXCHECK -# undef strtoull # if HAVE_RAW_DECL_STRTOULL _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " "use gnulib module strtoull for portability"); @@ -1961,7 +1917,6 @@ _GL_FUNCDECL_SYS (unlockpt, int, (int fd), ); _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); _GL_CXXALIASWARN (unlockpt); #elif defined GNULIB_POSIXCHECK -# undef unlockpt # if HAVE_RAW_DECL_UNLOCKPT _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " "use gnulib module unlockpt for portability"); @@ -1987,7 +1942,6 @@ _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); _GL_CXXALIASWARN (unsetenv); # endif #elif defined GNULIB_POSIXCHECK -# undef unsetenv # if HAVE_RAW_DECL_UNSETENV _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " "use gnulib module unsetenv for portability"); diff --git a/lib/string.in.h b/lib/string.in.h index fdcdd21bed6..a323b1cd6da 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -312,7 +312,6 @@ _GL_FUNCDECL_SYS (explicit_bzero, void, _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); _GL_CXXALIASWARN (explicit_bzero); #elif defined GNULIB_POSIXCHECK -# undef explicit_bzero # if HAVE_RAW_DECL_EXPLICIT_BZERO _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " "use gnulib module explicit_bzero for portability"); @@ -328,7 +327,6 @@ _GL_FUNCDECL_SYS (ffsl, int, (long int i), ); _GL_CXXALIAS_SYS (ffsl, int, (long int i)); _GL_CXXALIASWARN (ffsl); #elif defined GNULIB_POSIXCHECK -# undef ffsl # if HAVE_RAW_DECL_FFSL _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); # endif @@ -351,7 +349,6 @@ _GL_CXXALIAS_SYS (ffsll, int, (long long int i)); # endif _GL_CXXALIASWARN (ffsll); #elif defined GNULIB_POSIXCHECK -# undef ffsll # if HAVE_RAW_DECL_FFSLL _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); # endif @@ -409,10 +406,11 @@ _GL_CXXALIASWARN1 (memchr, void const *, _GL_CXXALIASWARN (memchr); # endif #elif defined GNULIB_POSIXCHECK -# undef memchr /* Assume memchr is always declared. */ -_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " - "use gnulib module memchr for portability" ); +_GL_WARN_ON_USE_CXX (memchr, + const void *, void *, (void const *, int, size_t), + "memchr has platform-specific bugs - " + "use gnulib module memchr for portability" ); #endif /* Are S1 and S2, of size N, bytewise equal? */ @@ -458,7 +456,6 @@ _GL_CXXALIAS_SYS (memmem, void *, # endif _GL_CXXALIASWARN (memmem); #elif defined GNULIB_POSIXCHECK -# undef memmem # if HAVE_RAW_DECL_MEMMEM _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " "use gnulib module memmem-simple for portability, " @@ -496,7 +493,6 @@ _GL_CXXALIAS_SYS (mempcpy, void *, _GL_CXXALIASWARN (mempcpy); # endif #elif defined GNULIB_POSIXCHECK -# undef mempcpy # if HAVE_RAW_DECL_MEMPCPY _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " "use gnulib module mempcpy for portability"); @@ -529,7 +525,6 @@ _GL_CXXALIASWARN1 (memrchr, void const *, _GL_CXXALIASWARN (memrchr); # endif #elif defined GNULIB_POSIXCHECK -# undef memrchr # if HAVE_RAW_DECL_MEMRCHR _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " "use gnulib module memrchr for portability"); @@ -560,7 +555,6 @@ _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); _GL_CXXALIASWARN (memset_explicit); # endif #elif defined GNULIB_POSIXCHECK -# undef memset_explicit # if HAVE_RAW_DECL_MEMSET_EXPLICIT _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - " "use gnulib module memset_explicit for portability"); @@ -595,7 +589,6 @@ _GL_CXXALIASWARN1 (rawmemchr, void const *, _GL_CXXALIASWARN (rawmemchr); # endif #elif defined GNULIB_POSIXCHECK -# undef rawmemchr # if HAVE_RAW_DECL_RAWMEMCHR _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " "use gnulib module rawmemchr for portability"); @@ -627,7 +620,6 @@ _GL_CXXALIAS_SYS (stpcpy, char *, _GL_CXXALIASWARN (stpcpy); # endif #elif defined GNULIB_POSIXCHECK -# undef stpcpy # if HAVE_RAW_DECL_STPCPY _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " "use gnulib module stpcpy for portability"); @@ -664,7 +656,6 @@ _GL_CXXALIAS_SYS (stpncpy, char *, _GL_CXXALIASWARN (stpncpy); # endif #elif defined GNULIB_POSIXCHECK -# undef stpncpy # if HAVE_RAW_DECL_STPNCPY _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " "use gnulib module stpncpy for portability"); @@ -674,7 +665,6 @@ _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " #if defined GNULIB_POSIXCHECK /* strchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ -# undef strchr /* Assume strchr is always declared. */ _GL_WARN_ON_USE_CXX (strchr, const char *, char *, (const char *, int), @@ -720,7 +710,6 @@ _GL_CXXALIASWARN1 (strchrnul, char const *, _GL_CXXALIASWARN (strchrnul); # endif #elif defined GNULIB_POSIXCHECK -# undef strchrnul # if HAVE_RAW_DECL_STRCHRNUL _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " "use gnulib module strchrnul for portability"); @@ -785,7 +774,6 @@ _GL_FUNCDECL_SYS (strdup, char *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef strdup # if HAVE_RAW_DECL_STRDUP _GL_WARN_ON_USE (strdup, "strdup is unportable - " "use gnulib module strdup for portability"); @@ -846,7 +834,6 @@ _GL_CXXALIAS_SYS (strncat, char *, _GL_CXXALIASWARN (strncat); # endif #elif defined GNULIB_POSIXCHECK -# undef strncat # if HAVE_RAW_DECL_STRNCAT _GL_WARN_ON_USE (strncat, "strncat is unportable - " "use gnulib module strncat for portability"); @@ -901,7 +888,6 @@ _GL_FUNCDECL_SYS (strndup, char *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef strndup # if HAVE_RAW_DECL_STRNDUP _GL_WARN_ON_USE (strndup, "strndup is unportable - " "use gnulib module strndup for portability"); @@ -932,7 +918,6 @@ _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); # endif _GL_CXXALIASWARN (strnlen); #elif defined GNULIB_POSIXCHECK -# undef strnlen # if HAVE_RAW_DECL_STRNLEN _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " "use gnulib module strnlen for portability"); @@ -944,7 +929,6 @@ _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " Even in this simple case, it does not work with multibyte strings if the locale encoding is GB18030 and one of the characters to be searched is a digit. */ -# undef strcspn /* Assume strcspn is always declared. */ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " "in multibyte locales - " @@ -981,7 +965,6 @@ _GL_CXXALIASWARN (strpbrk); Even in this simple case, it does not work with multibyte strings if the locale encoding is GB18030 and one of the characters to be searched is a digit. */ -# undef strpbrk _GL_WARN_ON_USE_CXX (strpbrk, const char *, char *, (const char *, const char *), "strpbrk cannot work correctly on character strings " @@ -1001,7 +984,6 @@ _GL_WARN_ON_USE_CXX (strpbrk, #if defined GNULIB_POSIXCHECK /* strspn() assumes the second argument is a list of single-byte characters. Even in this simple case, it cannot work with multibyte strings. */ -# undef strspn /* Assume strspn is always declared. */ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " "in multibyte locales - " @@ -1011,7 +993,6 @@ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " #if defined GNULIB_POSIXCHECK /* strrchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ -# undef strrchr /* Assume strrchr is always declared. */ _GL_WARN_ON_USE_CXX (strrchr, const char *, char *, (const char *, int), @@ -1046,13 +1027,11 @@ _GL_CXXALIAS_SYS (strsep, char *, (char **restrict __stringp, char const *restrict __delim)); _GL_CXXALIASWARN (strsep); # if defined GNULIB_POSIXCHECK -# undef strsep _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " "in multibyte locales - " "use mbssep if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK -# undef strsep # if HAVE_RAW_DECL_STRSEP _GL_WARN_ON_USE (strsep, "strsep is unportable - " "use gnulib module strsep for portability"); @@ -1095,11 +1074,13 @@ _GL_CXXALIASWARN (strstr); as a sequence of bytes, not of characters. */ # undef strstr /* Assume strstr is always declared. */ -_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " - "work correctly on character strings in most " - "multibyte locales - " - "use mbsstr if you care about internationalization, " - "or use strstr if you care about speed"); +_GL_WARN_ON_USE_CXX (strstr, + const char *, char *, (const char *, const char *), + "strstr is quadratic on many systems, and cannot " + "work correctly on character strings in most " + "multibyte locales - " + "use mbsstr if you care about internationalization, " + "or use strstr if you care about speed"); #endif /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive @@ -1145,7 +1126,6 @@ _GL_CXXALIASWARN (strcasestr); /* strcasestr() does not work with multibyte strings: It is a glibc extension, and glibc implements it only for unibyte locales. */ -# undef strcasestr # if HAVE_RAW_DECL_STRCASESTR _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " "strings in multibyte locales - " @@ -1191,7 +1171,7 @@ _GL_CXXALIAS_RPL (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr)); # else -# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK +# if @UNDEFINE_STRTOK_R@ # undef strtok_r # endif # if ! @HAVE_DECL_STRTOK_R@ @@ -1211,7 +1191,6 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " "use mbstok_r if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK -# undef strtok_r # if HAVE_RAW_DECL_STRTOK_R _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " "use gnulib module strtok_r for portability"); @@ -1579,7 +1558,6 @@ _GL_CXXALIAS_SYS (strerror, char *, (int)); _GL_CXXALIASWARN (strerror); # endif #elif defined GNULIB_POSIXCHECK -# undef strerror /* Assume strerror is always declared. */ _GL_WARN_ON_USE (strerror, "strerror is unportable - " "use gnulib module strerror to guarantee non-NULL result"); @@ -1607,7 +1585,6 @@ _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); _GL_CXXALIASWARN (strerror_r); # endif #elif defined GNULIB_POSIXCHECK -# undef strerror_r # if HAVE_RAW_DECL_STRERROR_R _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " "use gnulib module strerror_r-posix for portability"); @@ -1636,7 +1613,6 @@ _GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale)); _GL_CXXALIASWARN (strerror_l); # endif #elif defined GNULIB_POSIXCHECK -# undef strerror_l # if HAVE_RAW_DECL_STRERROR_L _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - " "use gnulib module strerror_l for portability"); @@ -1671,7 +1647,6 @@ _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); _GL_CXXALIASWARN (strerrorname_np); # endif #elif defined GNULIB_POSIXCHECK -# undef strerrorname_np # if HAVE_RAW_DECL_STRERRORNAME_NP _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " "use gnulib module strerrorname_np for portability"); @@ -1686,7 +1661,6 @@ _GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig), ); _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); _GL_CXXALIASWARN (sigabbrev_np); #elif defined GNULIB_POSIXCHECK -# undef sigabbrev_np # if HAVE_RAW_DECL_SIGABBREV_NP _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " "use gnulib module sigabbrev_np for portability"); @@ -1701,7 +1675,6 @@ _GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig), ); _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); _GL_CXXALIASWARN (sigdescr_np); #elif defined GNULIB_POSIXCHECK -# undef sigdescr_np # if HAVE_RAW_DECL_SIGDESCR_NP _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " "use gnulib module sigdescr_np for portability"); @@ -1725,7 +1698,6 @@ _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); # endif _GL_CXXALIASWARN (strsignal); #elif defined GNULIB_POSIXCHECK -# undef strsignal # if HAVE_RAW_DECL_STRSIGNAL _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " "use gnulib module strsignal for portability"); @@ -1751,7 +1723,6 @@ _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); # endif _GL_CXXALIASWARN (strverscmp); #elif defined GNULIB_POSIXCHECK -# undef strverscmp # if HAVE_RAW_DECL_STRVERSCMP _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " "use gnulib module strverscmp for portability"); diff --git a/lib/strnlen.c b/lib/strnlen.c index 155a594fccd..f6990415762 100644 --- a/lib/strnlen.c +++ b/lib/strnlen.c @@ -25,10 +25,10 @@ size_t strnlen (const char *s, size_t maxlen) { - size_t i = 0; /* Do not use memchr, because on some platforms memchr has undefined behavior if MAXLEN exceeds the number of bytes in S. */ - for (; i < maxlen && s[i]; i++) + size_t i; + for (i = 0; i < maxlen && s[i]; i++) continue; return i; } diff --git a/lib/sys_random.in.h b/lib/sys_random.in.h index 11663b2ebdc..1d9dff92995 100644 --- a/lib/sys_random.in.h +++ b/lib/sys_random.in.h @@ -94,7 +94,6 @@ _GL_CXXALIAS_SYS (getrandom, ssize_t, _GL_CXXALIASWARN (getrandom); # endif #elif defined GNULIB_POSIXCHECK -# undef getrandom # if HAVE_RAW_DECL_GETRANDOM _GL_WARN_ON_USE (getrandom, "getrandom is unportable - " "use gnulib module getrandom for portability"); diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 9106702deb1..891b4aa0fe0 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -283,7 +283,6 @@ _GL_CXXALIAS_SYS_CAST (pselect, int, _GL_CXXALIASWARN (pselect); # endif #elif defined GNULIB_POSIXCHECK -# undef pselect # if HAVE_RAW_DECL_PSELECT _GL_WARN_ON_USE (pselect, "pselect is not portable - " "use gnulib module pselect for portability"); @@ -316,7 +315,6 @@ _GL_CXXALIASWARN (select); # define select select_used_without_requesting_gnulib_module_select # endif #elif defined GNULIB_POSIXCHECK -# undef select # if HAVE_RAW_DECL_SELECT _GL_WARN_ON_USE (select, "select is not always POSIX compliant - " "use gnulib module select for portability"); diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 8f676cb390e..859f04e6b53 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -451,7 +451,6 @@ _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode)); # endif _GL_CXXALIASWARN (chmod); #elif defined GNULIB_POSIXCHECK -# undef chmod # if HAVE_RAW_DECL_CHMOD _GL_WARN_ON_USE (chmod, "chmod has portability problems - " "use gnulib module chmod for portability"); @@ -496,7 +495,6 @@ _GL_CXXALIAS_SYS (fchmodat, int, # endif _GL_CXXALIASWARN (fchmodat); #elif defined GNULIB_POSIXCHECK -# undef fchmodat # if HAVE_RAW_DECL_FCHMODAT _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " "use gnulib module openat for portability"); @@ -528,7 +526,6 @@ _GL_CXXALIASWARN (fstat); /* Above, we define stat to _stati64. */ # define fstat _fstati64 #elif defined GNULIB_POSIXCHECK -# undef fstat # if HAVE_RAW_DECL_FSTAT _GL_WARN_ON_USE (fstat, "fstat has portability problems - " "use gnulib module fstat for portability"); @@ -567,7 +564,6 @@ _GL_CXXALIASWARN (fstatat); # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat # endif #elif defined GNULIB_POSIXCHECK -# undef fstatat # if HAVE_RAW_DECL_FSTATAT _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " "use gnulib module openat for portability"); @@ -597,7 +593,6 @@ _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); _GL_CXXALIASWARN (futimens); # endif #elif defined GNULIB_POSIXCHECK -# undef futimens # if HAVE_RAW_DECL_FUTIMENS _GL_WARN_ON_USE (futimens, "futimens is not portable - " "use gnulib module futimens for portability"); @@ -618,7 +613,6 @@ _GL_CXXALIAS_SYS (getumask, mode_t, (void)); _GL_CXXALIASWARN (getumask); # endif #elif defined GNULIB_POSIXCHECK -# undef getumask # if HAVE_RAW_DECL_GETUMASK _GL_WARN_ON_USE (getumask, "getumask is not portable - " "use gnulib module getumask for portability"); @@ -636,7 +630,6 @@ _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode), _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); _GL_CXXALIASWARN (lchmod); #elif defined GNULIB_POSIXCHECK -# undef lchmod # if HAVE_RAW_DECL_LCHMOD _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " "use gnulib module lchmod for portability"); @@ -698,7 +691,6 @@ _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); #elif defined GNULIB_POSIXCHECK -# undef mkdir # if HAVE_RAW_DECL_MKDIR _GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " "use gnulib module mkdir for portability"); @@ -714,7 +706,6 @@ _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode), _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); _GL_CXXALIASWARN (mkdirat); #elif defined GNULIB_POSIXCHECK -# undef mkdirat # if HAVE_RAW_DECL_MKDIRAT _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " "use gnulib module openat for portability"); @@ -740,7 +731,6 @@ _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); # endif _GL_CXXALIASWARN (mkfifo); #elif defined GNULIB_POSIXCHECK -# undef mkfifo # if HAVE_RAW_DECL_MKFIFO _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " "use gnulib module mkfifo for portability"); @@ -768,7 +758,6 @@ _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); _GL_CXXALIASWARN (mkfifoat); # endif #elif defined GNULIB_POSIXCHECK -# undef mkfifoat # if HAVE_RAW_DECL_MKFIFOAT _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " "use gnulib module mkfifoat for portability"); @@ -794,7 +783,6 @@ _GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)); # endif _GL_CXXALIASWARN (mknod); #elif defined GNULIB_POSIXCHECK -# undef mknod # if HAVE_RAW_DECL_MKNOD _GL_WARN_ON_USE (mknod, "mknod is not portable - " "use gnulib module mknod for portability"); @@ -826,7 +814,6 @@ _GL_CXXALIAS_SYS (mknodat, int, _GL_CXXALIASWARN (mknodat); # endif #elif defined GNULIB_POSIXCHECK -# undef mknodat # if HAVE_RAW_DECL_MKNODAT _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " "use gnulib module mkfifoat for portability"); @@ -904,7 +891,6 @@ _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf) #define stat stat_used_without_requesting_gnulib_module_stat */ #elif defined GNULIB_POSIXCHECK -# undef stat # if HAVE_RAW_DECL_STAT _GL_WARN_ON_USE (stat, "stat is unportable - " "use gnulib module stat for portability"); @@ -944,7 +930,6 @@ _GL_CXXALIASWARN (lstat); # define lstat lstat_used_without_requesting_gnulib_module_lstat # endif #elif defined GNULIB_POSIXCHECK -# undef lstat # if HAVE_RAW_DECL_LSTAT _GL_WARN_ON_USE (lstat, "lstat is unportable - " "use gnulib module lstat for portability"); @@ -998,7 +983,6 @@ _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, _GL_CXXALIASWARN (utimensat); # endif #elif defined GNULIB_POSIXCHECK -# undef utimensat # if HAVE_RAW_DECL_UTIMENSAT _GL_WARN_ON_USE (utimensat, "utimensat is not portable - " "use gnulib module utimensat for portability"); diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index e6d15613bec..470e6c321e2 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -133,7 +133,6 @@ namespace GNULIB_NAMESPACE { } # endif #elif defined GNULIB_POSIXCHECK -# undef gettimeofday # if HAVE_RAW_DECL_GETTIMEOFDAY _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " "use gnulib module gettimeofday for portability"); diff --git a/lib/time.in.h b/lib/time.in.h index d28702d2f61..3ce2de16f2a 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -161,7 +161,6 @@ _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); _GL_CXXALIASWARN (timespec_get); # endif # elif defined GNULIB_POSIXCHECK -# undef timespec_get # if HAVE_RAW_DECL_TIMESPEC_GET _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " "use gnulib module timespec_get for portability"); @@ -190,7 +189,6 @@ _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); _GL_CXXALIASWARN (timespec_getres); # endif # elif defined GNULIB_POSIXCHECK -# undef timespec_getres # if HAVE_RAW_DECL_TIMESPEC_GETRES _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " "use gnulib module timespec_getres for portability"); @@ -212,7 +210,6 @@ _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); _GL_CXXALIASWARN (time); # endif # elif defined GNULIB_POSIXCHECK -# undef time # if HAVE_RAW_DECL_TIME _GL_WARN_ON_USE (time, "time has consistency problems - " "use gnulib module time for portability"); @@ -243,7 +240,6 @@ _GL_CXXALIAS_SYS (nanosleep, int, # endif _GL_CXXALIASWARN (nanosleep); # elif defined GNULIB_POSIXCHECK -# undef nanosleep # if HAVE_RAW_DECL_NANOSLEEP _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " "use gnulib module nanosleep for portability"); @@ -284,7 +280,6 @@ _GL_CXXALIAS_SYS (tzset, void, (void)); # endif _GL_CXXALIASWARN (tzset); # elif defined GNULIB_POSIXCHECK -# undef tzset # if HAVE_RAW_DECL_TZSET _GL_WARN_ON_USE (tzset, "tzset has portability problems - " "use gnulib module tzset for portability"); @@ -306,7 +301,6 @@ _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); _GL_CXXALIASWARN (mktime); # endif # elif defined GNULIB_POSIXCHECK -# undef mktime # if HAVE_RAW_DECL_MKTIME _GL_WARN_ON_USE (mktime, "mktime has portability problems - " "use gnulib module mktime for portability"); @@ -362,12 +356,10 @@ _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, _GL_CXXALIASWARN (gmtime_r); # endif # elif defined GNULIB_POSIXCHECK -# undef localtime_r # if HAVE_RAW_DECL_LOCALTIME_R _GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - " "use gnulib module time_r for portability"); # endif -# undef gmtime_r # if HAVE_RAW_DECL_GMTIME_R _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " "use gnulib module time_r for portability"); @@ -393,7 +385,6 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); _GL_CXXALIASWARN (localtime); # endif # elif defined GNULIB_POSIXCHECK -# undef localtime # if HAVE_RAW_DECL_LOCALTIME _GL_WARN_ON_USE (localtime, "localtime has portability problems - " "use gnulib module localtime for portability"); @@ -430,7 +421,6 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, struct tm *restrict __tm)); _GL_CXXALIASWARN (strptime); # elif defined GNULIB_POSIXCHECK -# undef strptime # if HAVE_RAW_DECL_STRPTIME _GL_WARN_ON_USE (strptime, "strptime is unportable - " "use gnulib module strptime for portability"); @@ -483,7 +473,6 @@ _GL_CXXALIAS_SYS (strftime, size_t, _GL_CXXALIASWARN (strftime); # endif # elif defined GNULIB_POSIXCHECK -# undef strftime # if HAVE_RAW_DECL_STRFTIME _GL_WARN_ON_USE (strftime, "strftime has portability problems - " "use gnulib module strftime-fixes for portability"); @@ -618,7 +607,6 @@ _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); _GL_CXXALIASWARN (timegm); # endif # elif defined GNULIB_POSIXCHECK -# undef timegm # if HAVE_RAW_DECL_TIMEGM _GL_WARN_ON_USE (timegm, "timegm is unportable - " "use gnulib module timegm for portability"); @@ -629,28 +617,24 @@ _GL_WARN_ON_USE (timegm, "timegm is unportable - " buffers when given outlandish struct tm values. Portable applications should use strftime (or even sprintf) instead. */ # if defined GNULIB_POSIXCHECK -# undef asctime # if HAVE_RAW_DECL_ASCTIME _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # endif # if defined GNULIB_POSIXCHECK -# undef asctime_r # if HAVE_RAW_DECL_ASCTIME_R _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # endif # if defined GNULIB_POSIXCHECK -# undef ctime # if HAVE_RAW_DECL_CTIME _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # endif # if defined GNULIB_POSIXCHECK -# undef ctime_r # if HAVE_RAW_DECL_CTIME_R _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 5b5838240aa..72d66eaa3a9 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -302,7 +302,6 @@ _GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); # endif _GL_CXXALIASWARN (access); #elif defined GNULIB_POSIXCHECK -# undef access # if HAVE_RAW_DECL_ACCESS /* The access() function is a security risk. */ _GL_WARN_ON_USE (access, "access does not always support X_OK - " @@ -339,7 +338,6 @@ _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIASWARN (chdir); #elif defined GNULIB_POSIXCHECK -# undef chdir # if HAVE_RAW_DECL_CHDIR _GL_WARN_ON_USE (chdir, "chdir is not always in - " "use gnulib module chdir for portability"); @@ -384,7 +382,6 @@ _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); # endif _GL_CXXALIASWARN (chown); #elif defined GNULIB_POSIXCHECK -# undef chown # if HAVE_RAW_DECL_CHOWN _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " "doesn't treat a uid or gid of -1 on some systems - " @@ -418,7 +415,6 @@ _GL_CXXALIASWARN (close); # define close close_used_without_requesting_gnulib_module_close # endif #elif defined GNULIB_POSIXCHECK -# undef close /* Assume close is always declared. */ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " "use gnulib module close for portability"); @@ -465,7 +461,6 @@ _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, _GL_CXXALIASWARN (copy_file_range); # endif #elif defined GNULIB_POSIXCHECK -# undef copy_file_range # if HAVE_RAW_DECL_COPY_FILE_RANGE _GL_WARN_ON_USE (copy_file_range, "copy_file_range is unportable - " @@ -492,7 +487,6 @@ _GL_CXXALIAS_SYS (dup, int, (int oldfd)); # endif _GL_CXXALIASWARN (dup); #elif defined GNULIB_POSIXCHECK -# undef dup # if HAVE_RAW_DECL_DUP _GL_WARN_ON_USE (dup, "dup is unportable - " "use gnulib module dup for portability"); @@ -537,7 +531,6 @@ _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); # endif _GL_CXXALIASWARN (dup2); #elif defined GNULIB_POSIXCHECK -# undef dup2 # if HAVE_RAW_DECL_DUP2 _GL_WARN_ON_USE (dup2, "dup2 is unportable - " "use gnulib module dup2 for portability"); @@ -585,7 +578,6 @@ _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); _GL_CXXALIASWARN (dup3); # endif #elif defined GNULIB_POSIXCHECK -# undef dup3 # if HAVE_RAW_DECL_DUP3 _GL_WARN_ON_USE (dup3, "dup3 is unportable - " "use gnulib module dup3 for portability"); @@ -653,7 +645,6 @@ _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " "use the gnulib module faccessat instead"); # endif #elif defined GNULIB_POSIXCHECK -# undef euidaccess # if HAVE_RAW_DECL_EUIDACCESS _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " "use gnulib module euidaccess for portability"); @@ -675,7 +666,6 @@ _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execl); #elif defined GNULIB_POSIXCHECK -# undef execl # if HAVE_RAW_DECL_EXECL _GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - " "use gnulib module execl for portability"); @@ -710,7 +700,6 @@ _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execle); #elif defined GNULIB_POSIXCHECK -# undef execle # if HAVE_RAW_DECL_EXECLE _GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - " "use gnulib module execle for portability"); @@ -746,7 +735,6 @@ _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execlp); #elif defined GNULIB_POSIXCHECK -# undef execlp # if HAVE_RAW_DECL_EXECLP _GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - " "use gnulib module execlp for portability"); @@ -783,7 +771,6 @@ _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); # endif _GL_CXXALIASWARN (execv); #elif defined GNULIB_POSIXCHECK -# undef execv # if HAVE_RAW_DECL_EXECV _GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - " "use gnulib module execv for portability"); @@ -822,7 +809,6 @@ _GL_CXXALIAS_SYS (execve, int, # endif _GL_CXXALIASWARN (execve); #elif defined GNULIB_POSIXCHECK -# undef execve # if HAVE_RAW_DECL_EXECVE _GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - " "use gnulib module execve for portability"); @@ -860,7 +846,6 @@ _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); # endif _GL_CXXALIASWARN (execvp); #elif defined GNULIB_POSIXCHECK -# undef execvp # if HAVE_RAW_DECL_EXECVP _GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - " "use gnulib module execvp for portability"); @@ -906,7 +891,6 @@ _GL_CXXALIAS_SYS (execvpe, int, _GL_CXXALIASWARN (execvpe); # endif #elif defined GNULIB_POSIXCHECK -# undef execvpe # if HAVE_RAW_DECL_EXECVPE _GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - " "use gnulib module execvpe for portability"); @@ -963,7 +947,6 @@ _GL_CXXALIAS_SYS (faccessat, int, _GL_CXXALIASWARN (faccessat); # endif #elif defined GNULIB_POSIXCHECK -# undef faccessat # if HAVE_RAW_DECL_FACCESSAT _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " "use gnulib module faccessat for portability"); @@ -1000,7 +983,6 @@ _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); _GL_EXTERN_C const char *_gl_directory_name (int fd); # endif #elif defined GNULIB_POSIXCHECK -# undef fchdir # if HAVE_RAW_DECL_FCHDIR _GL_WARN_ON_USE (fchdir, "fchdir is unportable - " "use gnulib module fchdir for portability"); @@ -1030,7 +1012,6 @@ _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, # endif _GL_CXXALIASWARN (fchownat); #elif defined GNULIB_POSIXCHECK -# undef fchownat # if HAVE_RAW_DECL_FCHOWNAT _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " "use gnulib module fchownat for portability"); @@ -1060,7 +1041,6 @@ _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); _GL_CXXALIASWARN (fdatasync); # endif #elif defined GNULIB_POSIXCHECK -# undef fdatasync # if HAVE_RAW_DECL_FDATASYNC _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " "use gnulib module fdatasync for portability"); @@ -1079,7 +1059,6 @@ _GL_FUNCDECL_SYS (fsync, int, (int fd), ); _GL_CXXALIAS_SYS (fsync, int, (int fd)); _GL_CXXALIASWARN (fsync); #elif defined GNULIB_POSIXCHECK -# undef fsync # if HAVE_RAW_DECL_FSYNC _GL_WARN_ON_USE (fsync, "fsync is unportable - " "use gnulib module fsync for portability"); @@ -1113,7 +1092,6 @@ _GL_CXXALIAS_SYS (ftruncate, int, _GL_CXXALIASWARN (ftruncate); # endif #elif defined GNULIB_POSIXCHECK -# undef ftruncate # if HAVE_RAW_DECL_FTRUNCATE _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " "use gnulib module ftruncate for portability"); @@ -1152,7 +1130,6 @@ _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); # endif _GL_CXXALIASWARN (getcwd); #elif defined GNULIB_POSIXCHECK -# undef getcwd # if HAVE_RAW_DECL_GETCWD _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " "use gnulib module getcwd for portability"); @@ -1210,7 +1187,6 @@ _GL_CXXALIAS_SYS (getdomainname, int, _GL_CXXALIASWARN (getdomainname); # endif #elif defined GNULIB_POSIXCHECK -# undef getdomainname # if HAVE_RAW_DECL_GETDOMAINNAME _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " "use gnulib module getdomainname for portability"); @@ -1238,7 +1214,6 @@ _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void)); # endif _GL_CXXALIASWARN (getdtablesize); #elif defined GNULIB_POSIXCHECK -# undef getdtablesize # if HAVE_RAW_DECL_GETDTABLESIZE _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " "use gnulib module getdtablesize for portability"); @@ -1269,7 +1244,6 @@ _GL_CXXALIAS_SYS (getentropy, int, _GL_CXXALIASWARN (getentropy); # endif #elif defined GNULIB_POSIXCHECK -# undef getentropy # if HAVE_RAW_DECL_GETENTROPY _GL_WARN_ON_USE (getentropy, "getentropy is unportable - " "use gnulib module getentropy for portability"); @@ -1302,7 +1276,6 @@ _GL_CXXALIAS_SYS (getgroups, int, # endif _GL_CXXALIASWARN (getgroups); #elif defined GNULIB_POSIXCHECK -# undef getgroups # if HAVE_RAW_DECL_GETGROUPS _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " "use gnulib module getgroups for portability"); @@ -1342,7 +1315,6 @@ _GL_CXXALIASWARN (gethostname); # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname # endif #elif defined GNULIB_POSIXCHECK -# undef gethostname # if HAVE_RAW_DECL_GETHOSTNAME _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " "use gnulib module gethostname for portability"); @@ -1377,7 +1349,6 @@ _GL_CXXALIAS_SYS (getlogin, char *, (void)); _GL_CXXALIASWARN (getlogin); # endif #elif defined GNULIB_POSIXCHECK -# undef getlogin # if HAVE_RAW_DECL_GETLOGIN _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " "use gnulib module getlogin for portability"); @@ -1420,7 +1391,6 @@ _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); _GL_CXXALIASWARN (getlogin_r); # endif #elif defined GNULIB_POSIXCHECK -# undef getlogin_r # if HAVE_RAW_DECL_GETLOGIN_R _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " "use gnulib module getlogin_r for portability"); @@ -1507,7 +1477,6 @@ _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); _GL_CXXALIASWARN (getpagesize); # endif #elif defined GNULIB_POSIXCHECK -# undef getpagesize # if HAVE_RAW_DECL_GETPAGESIZE _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " "use gnulib module getpagesize for portability"); @@ -1538,7 +1507,6 @@ _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); # endif _GL_CXXALIASWARN (getpass); #elif defined GNULIB_POSIXCHECK -# undef getpass # if HAVE_RAW_DECL_GETPASS _GL_WARN_ON_USE (getpass, "getpass is unportable - " "use gnulib module getpass or getpass-gnu for portability"); @@ -1581,7 +1549,6 @@ _GL_CXXALIAS_SYS (getusershell, char *, (void)); # endif _GL_CXXALIASWARN (getusershell); #elif defined GNULIB_POSIXCHECK -# undef getusershell # if HAVE_RAW_DECL_GETUSERSHELL _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " "use gnulib module getusershell for portability"); @@ -1605,7 +1572,6 @@ _GL_CXXALIAS_SYS (setusershell, void, (void)); # endif _GL_CXXALIASWARN (setusershell); #elif defined GNULIB_POSIXCHECK -# undef setusershell # if HAVE_RAW_DECL_SETUSERSHELL _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " "use gnulib module getusershell for portability"); @@ -1630,7 +1596,6 @@ _GL_CXXALIAS_SYS (endusershell, void, (void)); # endif _GL_CXXALIASWARN (endusershell); #elif defined GNULIB_POSIXCHECK -# undef endusershell # if HAVE_RAW_DECL_ENDUSERSHELL _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " "use gnulib module getusershell for portability"); @@ -1646,7 +1611,6 @@ _GL_FUNCDECL_SYS (group_member, int, (gid_t gid), ); _GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); _GL_CXXALIASWARN (group_member); #elif defined GNULIB_POSIXCHECK -# undef group_member # if HAVE_RAW_DECL_GROUP_MEMBER _GL_WARN_ON_USE (group_member, "group_member is unportable - " "use gnulib module group-member for portability"); @@ -1674,7 +1638,6 @@ _GL_CXXALIAS_SYS (isatty, int, (int fd)); # endif _GL_CXXALIASWARN (isatty); #elif defined GNULIB_POSIXCHECK -# undef isatty # if HAVE_RAW_DECL_ISATTY _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " "use gnulib module isatty for portability"); @@ -1719,7 +1682,6 @@ _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); # endif _GL_CXXALIASWARN (lchown); #elif defined GNULIB_POSIXCHECK -# undef lchown # if HAVE_RAW_DECL_LCHOWN _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " "use gnulib module lchown for portability"); @@ -1748,7 +1710,6 @@ _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); # endif _GL_CXXALIASWARN (link); #elif defined GNULIB_POSIXCHECK -# undef link # if HAVE_RAW_DECL_LINK _GL_WARN_ON_USE (link, "link is unportable - " "use gnulib module link for portability"); @@ -1787,7 +1748,6 @@ _GL_CXXALIAS_SYS (linkat, int, _GL_CXXALIASWARN (linkat); # endif #elif defined GNULIB_POSIXCHECK -# undef linkat # if HAVE_RAW_DECL_LINKAT _GL_WARN_ON_USE (linkat, "linkat is unportable - " "use gnulib module linkat for portability"); @@ -1817,7 +1777,6 @@ _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); # endif _GL_CXXALIASWARN (lseek); #elif defined GNULIB_POSIXCHECK -# undef lseek # if HAVE_RAW_DECL_LSEEK _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " "systems - use gnulib module lseek for portability"); @@ -1850,7 +1809,6 @@ _GL_FUNCDECL_SYS (pipe, int, (int fd[2]), _GL_CXXALIAS_SYS (pipe, int, (int fd[2])); _GL_CXXALIASWARN (pipe); #elif defined GNULIB_POSIXCHECK -# undef pipe # if HAVE_RAW_DECL_PIPE _GL_WARN_ON_USE (pipe, "pipe is unportable - " "use gnulib module pipe-posix for portability"); @@ -1884,7 +1842,6 @@ _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); _GL_CXXALIASWARN (pipe2); # endif #elif defined GNULIB_POSIXCHECK -# undef pipe2 # if HAVE_RAW_DECL_PIPE2 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " "use gnulib module pipe2 for portability"); @@ -1921,7 +1878,6 @@ _GL_CXXALIAS_SYS (pread, ssize_t, _GL_CXXALIASWARN (pread); # endif #elif defined GNULIB_POSIXCHECK -# undef pread # if HAVE_RAW_DECL_PREAD _GL_WARN_ON_USE (pread, "pread is unportable - " "use gnulib module pread for portability"); @@ -1958,7 +1914,6 @@ _GL_CXXALIAS_SYS (pwrite, ssize_t, _GL_CXXALIASWARN (pwrite); # endif #elif defined GNULIB_POSIXCHECK -# undef pwrite # if HAVE_RAW_DECL_PWRITE _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " "use gnulib module pwrite for portability"); @@ -2036,7 +1991,6 @@ _GL_CXXALIAS_SYS (readlink, ssize_t, # endif _GL_CXXALIASWARN (readlink); #elif defined GNULIB_POSIXCHECK -# undef readlink # if HAVE_RAW_DECL_READLINK _GL_WARN_ON_USE (readlink, "readlink is unportable - " "use gnulib module readlink for portability"); @@ -2071,7 +2025,6 @@ _GL_CXXALIAS_SYS (readlinkat, ssize_t, _GL_CXXALIASWARN (readlinkat); # endif #elif defined GNULIB_POSIXCHECK -# undef readlinkat # if HAVE_RAW_DECL_READLINKAT _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " "use gnulib module readlinkat for portability"); @@ -2098,7 +2051,6 @@ _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); # endif _GL_CXXALIASWARN (rmdir); #elif defined GNULIB_POSIXCHECK -# undef rmdir # if HAVE_RAW_DECL_RMDIR _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " "use gnulib module rmdir for portability"); @@ -2155,7 +2107,6 @@ _GL_CXXALIAS_SYS_CAST (sethostname, int, _GL_CXXALIASWARN (sethostname); # endif #elif defined GNULIB_POSIXCHECK -# undef sethostname # if HAVE_RAW_DECL_SETHOSTNAME _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " "use gnulib module sethostname for portability"); @@ -2183,7 +2134,6 @@ _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); # endif _GL_CXXALIASWARN (sleep); #elif defined GNULIB_POSIXCHECK -# undef sleep # if HAVE_RAW_DECL_SLEEP _GL_WARN_ON_USE (sleep, "sleep is unportable - " "use gnulib module sleep for portability"); @@ -2238,7 +2188,6 @@ _GL_CXXALIAS_SYS (symlink, int, # endif _GL_CXXALIASWARN (symlink); #elif defined GNULIB_POSIXCHECK -# undef symlink # if HAVE_RAW_DECL_SYMLINK _GL_WARN_ON_USE (symlink, "symlink is not portable - " "use gnulib module symlink for portability"); @@ -2270,7 +2219,6 @@ _GL_CXXALIAS_SYS (symlinkat, int, _GL_CXXALIASWARN (symlinkat); # endif #elif defined GNULIB_POSIXCHECK -# undef symlinkat # if HAVE_RAW_DECL_SYMLINKAT _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " "use gnulib module symlinkat for portability"); @@ -2302,7 +2250,6 @@ _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); _GL_CXXALIASWARN (truncate); # endif #elif defined GNULIB_POSIXCHECK -# undef truncate # if HAVE_RAW_DECL_TRUNCATE _GL_WARN_ON_USE (truncate, "truncate is unportable - " "use gnulib module truncate for portability"); @@ -2336,7 +2283,6 @@ _GL_CXXALIAS_SYS (ttyname_r, int, _GL_CXXALIASWARN (ttyname_r); # endif #elif defined GNULIB_POSIXCHECK -# undef ttyname_r # if HAVE_RAW_DECL_TTYNAME_R _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " "use gnulib module ttyname_r for portability"); @@ -2363,7 +2309,6 @@ _GL_CXXALIAS_SYS (unlink, int, (char const *file)); # endif _GL_CXXALIASWARN (unlink); #elif defined GNULIB_POSIXCHECK -# undef unlink # if HAVE_RAW_DECL_UNLINK _GL_WARN_ON_USE (unlink, "unlink is not portable - " "use gnulib module unlink for portability"); @@ -2403,7 +2348,6 @@ _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); # endif _GL_CXXALIASWARN (unlinkat); #elif defined GNULIB_POSIXCHECK -# undef unlinkat # if HAVE_RAW_DECL_UNLINKAT _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " "use gnulib module unlinkat for portability"); @@ -2433,7 +2377,6 @@ _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); # endif _GL_CXXALIASWARN (usleep); #elif defined GNULIB_POSIXCHECK -# undef usleep # if HAVE_RAW_DECL_USLEEP _GL_WARN_ON_USE (usleep, "usleep is unportable - " "use gnulib module usleep for portability");