about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@redhat.com>2016-10-29 23:45:40 -0400
committerCarlos O'Donell <carlos@redhat.com>2016-10-29 23:50:56 -0400
commit93fe09cb5fbf68e473d5514adc069d2f6115cc23 (patch)
tree5feb90cefe21213db677fc6d331563132ffe3cc6 /locale
parent960294f00a33559af40143ac056f68d21c006d27 (diff)
downloadglibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.tar.gz
glibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.tar.xz
glibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.zip
Bug 20729: Fix building with -Os.
This commit adds a new DIAG_IGNORE_Os_NEEDS_COMMENT which is only
enabled when compiling with -Os. This allows developers working on
-Os enabled builds to mark false-positive warnings without impacting the
warnings emitted at -O2.

Then using the new DIAG_IGNORE_Os_NEEDS_COMMENT we fix 6 warnings
generated with GCC 5 to get -Os builds working again.
Diffstat (limited to 'locale')
-rw-r--r--locale/weight.h8
-rw-r--r--locale/weightwc.h8
2 files changed, 16 insertions, 0 deletions
diff --git a/locale/weight.h b/locale/weight.h
index c99730c4fb..1f61f01e1e 100644
--- a/locale/weight.h
+++ b/locale/weight.h
@@ -61,9 +61,17 @@ findidx (const int32_t *table,
 	     already.  */
 	  size_t cnt;
 
+	  /* With GCC 5.3 when compiling with -Os the compiler warns
+	     that seq2.back_us, which becomes usrc, might be used
+	     uninitialized.  This can't be true because we pass a length
+	     of -1 for len at the same time which means that this loop
+	     never executes.  */
+	  DIAG_PUSH_NEEDS_COMMENT;
+	  DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
 	  for (cnt = 0; cnt < nhere && cnt < len; ++cnt)
 	    if (cp[cnt] != usrc[cnt])
 	      break;
+	  DIAG_POP_NEEDS_COMMENT;
 
 	  if (cnt == nhere)
 	    {
diff --git a/locale/weightwc.h b/locale/weightwc.h
index ab26482996..e42ce13241 100644
--- a/locale/weightwc.h
+++ b/locale/weightwc.h
@@ -59,9 +59,17 @@ findidx (const int32_t *table,
 	     already.  */
 	  size_t cnt;
 
+	  /* With GCC 5.3 when compiling with -Os the compiler warns
+	     that seq2.back_us, which becomes usrc, might be used
+	     uninitialized.  This can't be true because we pass a length
+	     of -1 for len at the same time which means that this loop
+	     never executes.  */
+	  DIAG_PUSH_NEEDS_COMMENT;
+	  DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
 	  for (cnt = 0; cnt < nhere && cnt < len; ++cnt)
 	    if (cp[cnt] != usrc[cnt])
 	      break;
+	  DIAG_POP_NEEDS_COMMENT;
 
 	  if (cnt == nhere)
 	    {