[PATCH] Fix -Wundef warnings in fnmatch.c

Siddhesh Poyarekar siddhesh@redhat.com
Thu Jul 31 20:25:00 GMT 2014


On Thu, Jul 31, 2014 at 12:57:03PM -0700, Roland McGrath wrote:
> I'd tend toward putting more HAVE_* defines in libc-symbols.h rather than
> having gnulib-shared code test _LIBC.

OK, how about this?

Siddhesh

	* include/libc-symbols.h (HAVE_MBSTATE_T): Define macro.
	(HAVE_MBSRTOWCS): Likewise.
	* posix/fnmatch.c: Include string.h unconditionally.

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 03061ae..d833eb7 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -57,9 +57,11 @@
    so it's harmless.  */
 #define HAVE_CONFIG_H	0
 
-/* Define this for the benefit of portable GNU code that wants to check it.
-   Of course, it's never false when building libc!  */
+/* Define these macros for the benefit of portable GNU code that wants to check
+   them.  Of course, STDC_HEADERS is never false when building libc!  */
 #define STDC_HEADERS	1
+#define HAVE_MBSTATE_T	1
+#define HAVE_MBSRTOWCS	1
 
 /* The symbols in all the user (non-_) macros are C symbols.  */
 
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index ca95ab4..c330a12 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -28,12 +28,7 @@
 #include <errno.h>
 #include <fnmatch.h>
 #include <ctype.h>
-
-#if HAVE_STRING_H || defined _LIBC
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
 
 #if defined STDC_HEADERS || defined _LIBC
 # include <stdlib.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20140731/43eb5731/attachment.sig>


More information about the Libc-alpha mailing list