]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix two more -Os strcoll / wcscoll build failures.
authorJoseph Myers <joseph@codesourcery.com>
Tue, 27 Feb 2018 16:54:14 +0000 (16:54 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 27 Feb 2018 16:55:42 +0000 (16:55 +0000)
Continuing fixes for -Os build issues shown with build-many-glibcs.py,
this patch adds uses of DIAG_* to disable -Wmaybe-uninitialized in two
more places where code inlined from strcoll / wcscoll is wrongly
diagnosed as possibly using uninitialized structure fields.  (All
these warnings in different places for these functions are I think
essentially the same bug.)

Tested with build-many-glibcs.py for alpha-linux-gnu and
mips-linux-gnu that this fixes the -Os build failures for those
configurations with GCC 7.

* locale/weightwc.h (findidx): Ignore -Wmaybe-uninitialized for
-Os in two more places.

ChangeLog
locale/weightwc.h

index 687eefd0b688f752b8e86ab9b6025498fc25bdfc..72f03aa3965140a9779d5a9f88d51c5ec47efb0d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-27  Joseph Myers  <joseph@codesourcery.com>
+
+       * locale/weightwc.h (findidx): Ignore -Wmaybe-uninitialized for
+       -Os in two more places.
+
 2018-02-27  Mike FABIAN  <mfabian@redhat.com>
 
        See this bug https://sourceware.org/bugzilla/show_bug.cgi?id=22898
index ac25ba95b97512c9b867f79d7e71774447239f99..36c65b5623a367dcb42b24f190f0c759fafb512f 100644 (file)
@@ -28,7 +28,15 @@ findidx (const int32_t *table,
         const wint_t *extra,
         const wint_t **cpp, size_t len)
 {
+  /* With GCC 7 when compiling with -Os the compiler warns that
+     seq1.back_us and seq2.back_us, which become *cpp, might be used
+     uninitialized.  This is impossible as this function cannot be
+     called except in cases where those fields have been
+     initialized.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
   wint_t ch = *(*cpp)++;
+  DIAG_POP_NEEDS_COMMENT;
   int32_t i = __collidx_table_lookup ((const char *) table, ch);
 
   if (i >= 0)
@@ -107,11 +115,18 @@ findidx (const int32_t *table,
              continue;
            }
 
+         /* 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");
          if (cp[nhere - 1] > usrc[nhere -1])
            {
              cp += 2 * nhere;
              continue;
            }
+         DIAG_POP_NEEDS_COMMENT;
 
          if (cp[2 * nhere - 1] < usrc[nhere -1])
            {