public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Joseph Myers <joseph@codesourcery.com>, libc-alpha@sourceware.org
Subject: Re: Add macros for diagnostic control, use them in locale/weightwc.h
Date: Tue, 18 Nov 2014 20:53:00 -0000	[thread overview]
Message-ID: <546BB1B1.50000@cs.ucla.edu> (raw)
In-Reply-To: <alpine.DEB.2.10.1411181803130.11642@digraph.polyomino.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

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.

[-- Attachment #2: Wuninitialized.patch --]
[-- Type: text/x-patch, Size: 1056 bytes --]

diff --git a/ChangeLog b/ChangeLog
index 37b1459..ab9dc88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* locale/weightwc.h (findidx): Disable -Wmaybe-uninitialized.
+
 2014-11-18  Roland McGrath  <roland@hack.frob.com>
 
 	* nptl/createthread.c: New file.
diff --git a/locale/weightwc.h b/locale/weightwc.h
index 0f70b00..383d34e 100644
--- a/locale/weightwc.h
+++ b/locale/weightwc.h
@@ -19,6 +19,14 @@
 #ifndef _WEIGHTWC_H_
 #define _WEIGHTWC_H_	1
 
+#pragma GCC diagnostic push
+
+/* Seen on x86_64 (inlined from fnmatch_loop.c:internal_fnwmatch):
+   "'*((void *)&str+4)' may be used uninitialized in this function".  */
+#if __GNUC_PREREQ (4, 7) && !__GNUC_PREPREQ (4, 10)
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+
 /* Find index of weight.  */
 static inline int32_t __attribute__ ((always_inline))
 findidx (const int32_t *table,
@@ -115,4 +123,6 @@ findidx (const int32_t *table,
   return 0x43219876;
 }
 
+#pragma GCC diagnostic pop
+
 #endif	/* weightwc.h */

  reply	other threads:[~2014-11-18 20:53 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 18:04 Joseph Myers
2014-11-18 20:53 ` Paul Eggert [this message]
2014-11-18 21:18   ` Roland McGrath
2014-11-18 22:29     ` Paul Eggert
2014-11-18 23:16       ` Joseph Myers
2014-11-18 23:58         ` Paul Eggert
2014-11-19  0:06           ` Joseph Myers
2014-11-19  6:52             ` Paul Eggert
2014-11-19  9:09             ` Andreas Schwab
2014-11-19 15:42               ` Joseph Myers
2014-11-18 23:00   ` Joseph Myers
2014-11-18 23:49     ` Paul Eggert
2014-11-19  0:03       ` Joseph Myers
2014-11-19  6:51         ` Paul Eggert
2014-11-19 14:56           ` Joseph Myers
2014-11-21 17:29             ` Paul Eggert
2014-11-21 18:27               ` Joseph Myers
2014-11-21 17:05 ` Joseph Myers
2014-11-21 17:43   ` Paul Eggert
2014-11-21 18:12     ` Joseph Myers
2014-11-21 19:17       ` Paul Eggert
2014-11-21 22:47         ` Joseph Myers
2014-11-21 23:03           ` Joseph Myers
2014-11-22  5:14           ` Paul Eggert
2014-11-24 23:47             ` Roland McGrath
2014-11-25  1:29               ` Joseph Myers
2014-11-25 22:35                 ` Paul Eggert
2014-11-25 22:42                   ` Joseph Myers
2014-11-26  0:24                     ` Paul Eggert
2014-11-26  0:36                       ` Joseph Myers
2014-11-26  0:42                         ` Paul Eggert
2014-11-25 22:42                   ` Roland McGrath
2014-11-25  0:00             ` Roland McGrath
2014-11-25 22:23               ` Paul Eggert
2014-11-21 22:29   ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546BB1B1.50000@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).