summaryrefslogtreecommitdiff
path: root/string
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 /string
parent960294f00a33559af40143ac056f68d21c006d27 (diff)
downloadglibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.tar.gz
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 'string')
-rw-r--r--string/strcoll_l.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/string/strcoll_l.c b/string/strcoll_l.c
index 4d1e3ab15e..5605dbfa8a 100644
--- a/string/strcoll_l.c
+++ b/string/strcoll_l.c
@@ -24,6 +24,7 @@
#include <stdint.h>
#include <string.h>
#include <sys/param.h>
+#include <libc-internal.h>
#ifndef STRING_TYPE
# define STRING_TYPE char
@@ -170,7 +171,19 @@ get_next_seq (coll_seq *seq, int nrules, const unsigned char *rulesets,
}
}
+ /* With GCC 5.3 when compiling with -Os the compiler complains
+ that idx, taken from seq->idx (seq1 or seq2 from STRCOLL) may
+ be used uninitialized. In general this can't possibly be true
+ since seq1.idx and seq2.idx are initialized to zero in the
+ outer function. Only one case where seq->idx is restored from
+ seq->save_idx might result in an uninitialized idx value, but
+ it is guarded by a sequence of checks against backw_stop which
+ ensures that seq->save_idx was saved to first and contains a
+ valid value. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
len = weights[idx++];
+ DIAG_POP_NEEDS_COMMENT;
/* Skip over indices of previous levels. */
for (int i = 0; i < pass; i++)
{