Add macros for diagnostic control, use them in locale/weightwc.h
Paul Eggert
eggert@cs.ucla.edu
Tue Nov 18 20:53:00 GMT 2014
On 11/18/2014 10:04 AM, Joseph Myers wrote:
> + DIAG_PUSH;
> +#if __GNUC_PREREQ (4, 7)
> + DIAG_IGNORE (-Wmaybe-uninitialized, 4.9);
> +#endif
> if (cp[nhere - 1] > usrc[nhere -1])
> {
> cp += 2 * nhere;
> @@ -105,6 +117,7 @@ findidx (const int32_t *table,
> /* This range matches the next characters. Now find
> the offset in the indirect table. */
> offset = usrc[nhere - 1] - cp[nhere - 1];
> + DIAG_POP;
My kneejerk reaction is that attempting to minimize the scope of
disabled warnings will make code harder to read and maintain, and the
costs of minimization may outweigh the benefits.
Also, the distinction between GCC version "4, 7" (which is checked) and
version "4.9" (which is not) is bothersome. Inevitably the unchecked
version numbers will become wrong. If we're going to have a "4.9" at
all, we should check it.
How about the attached (untested) patch instead? This is simpler and
less intrusive and should scale better. It disables the diagnostic in
some places that it doesn't absolutely need to, but it separates
concerns better and overall I expect it would have a better
cost-to-benefit ratio.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wuninitialized.patch
Type: text/x-patch
Size: 1056 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20141118/4134650a/attachment.bin>
More information about the Libc-alpha
mailing list