about summary refs log tree commit diff
path: root/locale/weight.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2018-02-07 13:36:14 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-02-07 13:36:14 +0000
commitce999220903ae5ad027a2a7df722acaf2cecf4bf (patch)
tree0ffdef7b0e5098deb42b92e2370961baab9fecbb /locale/weight.h
parentb7c83ca30ef8e85b6642151d95600a36535f8d97 (diff)
downloadglibc-ce999220903ae5ad027a2a7df722acaf2cecf4bf.tar.gz
glibc-ce999220903ae5ad027a2a7df722acaf2cecf4bf.tar.xz
glibc-ce999220903ae5ad027a2a7df722acaf2cecf4bf.zip
Fix -Os strcoll, wcscoll, build (bug 21313).
The findidx functions used in implementing strcoll / wcscoll already
use DIAG_IGNORE_Os_NEEDS_COMMENT for spurious -Wmaybe-uninitialized
warnings that appear with -Os.  In building with GCC 7 for x86_64 with
-Os, I find there are additional such warnings, for the same structure
elements, which are spurious for the same reasons given in the
existing comments (and this was also reported for MIPS with GCC 5 in
bug 21313).  This patch adds corresponding uses of DIAG_* in the
places that get the additional warnings.

Tested for x86_64 with -Os that this eliminates those warnings and so
allows the build to progress further.

	[BZ #21313]
	* locale/weight.h (findidx): Disable -Wmaybe-uninitialized for -Os
	in another place.
	* locale/weightwc.h (findidx): Likewise.
Diffstat (limited to 'locale/weight.h')
-rw-r--r--locale/weight.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/locale/weight.h b/locale/weight.h
index e2fdae1713..6028d3595e 100644
--- a/locale/weight.h
+++ b/locale/weight.h
@@ -132,7 +132,15 @@ findidx (const int32_t *table,
 	      do
 		{
 		  offset <<= 8;
+		  /* With GCC 7 when compiling with -Os the compiler
+		     warns that seq1.back_us and seq2.back_us, which
+		     become usrc, might be used uninitialized.  This
+		     is impossible for the same reason as described
+		     above.  */
+		  DIAG_PUSH_NEEDS_COMMENT;
+		  DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
 		  offset += usrc[cnt] - cp[cnt];
+		  DIAG_POP_NEEDS_COMMENT;
 		}
 	      while (++cnt < nhere);
 	    }