From patchwork Thu Jun 26 15:20:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1764 Received: (qmail 19770 invoked by alias); 26 Jun 2014 15:19:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 19577 invoked by uid 89); 26 Jun 2014 15:19:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Date: Thu, 26 Jun 2014 20:50:55 +0530 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [PATCH] Fix Wundef warning for WIDE_CHAR_VERSION Message-ID: <20140626152054.GX4477@spoyarek.pnq.redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) fnmatch.c defines WIDE_CHAR_VERSION as 1 for wide chars, but does not define it for the non-wide char bits. Define it and also undef it in fnmatch_loop.c like all other macros. Tested on x86_64 to verify that the code before and after are identical except for line numbers passed to __assert_fail. Siddhesh * posix/fnmatch.c: Define WIDE_CHAR_VERSION. * posix/fnmatch_loop.c: Undefine WIDE_CHAR_VERSION. (FCT): Check value of WIDE_CHAR_VERSION instead of checking if it is defined. --- posix/fnmatch.c | 1 + posix/fnmatch_loop.c | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/posix/fnmatch.c b/posix/fnmatch.c index 4f14a8b..ca95ab4 100644 --- a/posix/fnmatch.c +++ b/posix/fnmatch.c @@ -225,6 +225,7 @@ __wcschrnul (s, c) # define MEMPCPY(D, S, N) __mempcpy (D, S, N) # define MEMCHR(S, C, N) memchr (S, C, N) # define STRCOLL(S1, S2) strcoll (S1, S2) +# define WIDE_CHAR_VERSION 0 # include "fnmatch_loop.c" diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c index 544769b..1957397 100644 --- a/posix/fnmatch_loop.c +++ b/posix/fnmatch_loop.c @@ -504,7 +504,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) { int32_t table_size; const int32_t *symb_table; -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION char str[c1]; unsigned int strcnt; # else @@ -516,7 +516,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) int32_t second; int32_t hash; -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION /* We have to convert the name to a single-byte string. This is possible since the names consist of ASCII characters and the internal @@ -571,7 +571,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) { /* Compare the byte sequence but only if this is not part of a range. */ -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION int32_t *wextra; idx += 1 + extra[idx]; @@ -583,7 +583,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) if (! is_range) { -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION for (c1 = 0; (int32_t) c1 < wextra[idx]; ++c1) @@ -604,7 +604,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) /* Get the collation sequence value. */ is_seqval = 1; -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION cold = wextra[1 + wextra[idx]]; # else /* Adjust for the alignment. */ @@ -667,7 +667,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) uint32_t lcollseq; UCHAR cend = *p++; -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION /* Search in the `names' array for the characters. */ fcollseq = __collseq_table_lookup (collseq, fn); if (fcollseq == ~((uint32_t) 0)) @@ -722,7 +722,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) { int32_t table_size; const int32_t *symb_table; -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION char str[c1]; unsigned int strcnt; # else @@ -734,7 +734,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) int32_t second; int32_t hash; -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION /* We have to convert the name to a single-byte string. This is possible since the names consist of ASCII characters and the internal @@ -789,7 +789,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) { /* Compare the byte sequence but only if this is not part of a range. */ -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION int32_t *wextra; idx += 1 + extra[idx]; @@ -800,7 +800,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) # endif /* Get the collation sequence value. */ is_seqval = 1; -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION cend = wextra[1 + wextra[idx]]; # else /* Adjust for the alignment. */ @@ -832,7 +832,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) characters which are not mentioned in the collation specification. */ if ( -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION lcollseq == 0xffffffff || # endif lcollseq <= fcollseq) @@ -844,7 +844,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) hcollseq = cend; else { -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION hcollseq = __collseq_table_lookup (collseq, cend); if (hcollseq == ~((uint32_t) 0)) @@ -865,7 +865,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) if (lcollseq <= hcollseq && fcollseq <= hcollseq) goto matched; } -# ifdef WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION range_not_matched: # endif #else @@ -1276,3 +1276,4 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, #undef STRCAT #undef L #undef BTOWC +#undef WIDE_CHAR_VERSION