Fix -Wundef warnings in fnmatch.c

Message ID 20140731194853.GJ16739@spoyarek.pnq.redhat.com
State Superseded
Headers

Commit Message

Siddhesh Poyarekar July 31, 2014, 7:48 p.m. UTC
  Fixes -Wundef warnings for MBSTATE_T and HAVE_STRING_H.  The
HAVE_STRING_H bit is a merge from the gnulib fnmatch.c and the
MBSTATE_T fix has been posted to gnulib for inclusion.

Tested that the code is unchanged on i386.

Siddhesh

	* posix/fnmatch.c: Include string.h unconditionally.
	[defined _LIBC || WIDE_CHAR_SUPPORT]: Check if _LIBC is
	defined before checking MBSTATE_T.

---
 posix/fnmatch.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
  

Comments

Roland McGrath July 31, 2014, 7:57 p.m. UTC | #1
I'd tend toward putting more HAVE_* defines in libc-symbols.h rather than
having gnulib-shared code test _LIBC.
  

Patch

diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index ca95ab4..8b4d0dc 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>
@@ -136,7 +131,7 @@  extern int fnmatch (const char *pattern, const char *string, int flags);
 #   define ISWCTYPE(WC, WT)	iswctype (WC, WT)
 #  endif
 
-#  if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
+#  if defined _LIBC || (HAVE_MBSTATE_T && HAVE_MBSRTOWCS)
 /* In this case we are implementing the multibyte character handling.  */
 #   define HANDLE_MULTIBYTE	1
 #  endif