changeset 8074:2700fc6b6734

Make the redefinitions to error-provoking symbols conditional.
author Bruno Haible <bruno@clisp.org>
date Sat, 03 Feb 2007 00:01:56 +0000
parents eaa00773406b
children 731d7d652c87
files ChangeLog lib/string_.h
diffstat 2 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-02-02  Bruno Haible  <bruno@clisp.org>
+
+	* lib/string_.h (memmem, mempcpy, memrchr, stpcpy, stpncpy, strchrnul,
+	strdup, strndup, strnlen, strpbrk, strsep, strtok_r): Provoke a link
+	error only if GNULIB_POSIXCHECK is defined. Needed to avoid artificial
+	portability problems if one of these functions is only used on specific
+	platforms.
+	Reported by Paul Eggert.
+
 2007-02-02  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Avoid mempcpy in the regex code, as the string.h mempcpy stuff
--- a/lib/string_.h
+++ b/lib/string_.h
@@ -62,7 +62,7 @@
 extern void *memmem (void const *__haystack, size_t __haystack_len,
 		     void const *__needle, size_t __needle_len);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef memmem
 # define memmem memmem_is_unportable__use_gnulib_module_memmem_for_portability
 #endif
@@ -74,7 +74,7 @@
 extern void *mempcpy (void *restrict __dest, void const *restrict __src,
 		      size_t __n);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef mempcpy
 # define mempcpy mempcpy_is_unportable__use_gnulib_module_mempcpy_for_portability
 #endif
@@ -84,7 +84,7 @@
 # if ! @HAVE_DECL_MEMRCHR@
 extern void *memrchr (void const *, int, size_t);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef memrchr
 # define memrchr memrchr_is_unportable__use_gnulib_module_memrchr_for_portability
 #endif
@@ -94,7 +94,7 @@
 # if ! @HAVE_STPCPY@
 extern char *stpcpy (char *restrict __dst, char const *restrict __src);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef stpcpy
 # define stpcpy stpcpy_is_unportable__use_gnulib_module_stpcpy_for_portability
 #endif
@@ -107,7 +107,7 @@
 extern char *stpncpy (char *restrict __dst, char const *restrict __src,
 		      size_t __n);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef stpncpy
 # define stpncpy stpncpy_is_unportable__use_gnulib_module_stpncpy_for_portability
 #endif
@@ -153,7 +153,7 @@
 # if ! @HAVE_STRCHRNUL@
 extern char *strchrnul (char const *__s, int __c_in);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef strchrnul
 # define strchrnul strchrnul_is_unportable__use_gnulib_module_strchrnul_for_portability
 #endif
@@ -163,7 +163,7 @@
 # if ! @HAVE_DECL_STRDUP@ && ! defined strdup
 extern char *strdup (char const *__s);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef strdup
 # define strdup strdup_is_unportable__use_gnulib_module_strdup_for_portability
 #endif
@@ -177,7 +177,7 @@
 extern char *strndup (char const *__string, size_t __n);
 #  endif
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef strndup
 # define strndup strndup_is_unportable__use_gnulib_module_strndup_for_portability
 #endif
@@ -189,7 +189,7 @@
 # if ! @HAVE_DECL_STRNLEN@
 extern size_t strnlen (char const *__string, size_t __maxlen);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef strnlen
 # define strnlen strnlen_is_unportable__use_gnulib_module_strnlen_for_portability
 #endif
@@ -199,7 +199,7 @@
 # if ! @HAVE_STRPBRK@
 extern char *strpbrk (char const *__s, char const *__accept);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef strpbrk
 # define strpbrk strpbrk_is_unportable__use_gnulib_module_strpbrk_for_portability
 #endif
@@ -224,7 +224,7 @@
 # if ! @HAVE_STRSEP@
 extern char *strsep (char **restrict __stringp, char const *restrict __delim);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef strsep
 # define strsep strsep_is_unportable__use_gnulib_module_strsep_for_portability
 #endif
@@ -290,7 +290,7 @@
 extern char *strtok_r (char *restrict __s, char const *restrict __sep,
 		       char **restrict __lasts);
 # endif
-#else
+#elif defined GNULIB_POSIXCHECK
 # undef strtok_r
 # define strtok_r strtok_r_is_unportable__use_gnulib_module_strtok_r_for_portability
 #endif