diff options
author | Carlos O'Donell <carlos@redhat.com> | 2016-10-29 23:45:40 -0400 |
---|---|---|
committer | Carlos O'Donell <carlos@redhat.com> | 2016-10-29 23:50:56 -0400 |
commit | 93fe09cb5fbf68e473d5514adc069d2f6115cc23 (patch) | |
tree | 5feb90cefe21213db677fc6d331563132ffe3cc6 /iconvdata | |
parent | 960294f00a33559af40143ac056f68d21c006d27 (diff) | |
download | glibc-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 'iconvdata')
-rw-r--r-- | iconvdata/iso-2022-cn-ext.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/iconvdata/iso-2022-cn-ext.c b/iconvdata/iso-2022-cn-ext.c index df5b5df1fd..92970a06eb 100644 --- a/iconvdata/iso-2022-cn-ext.c +++ b/iconvdata/iso-2022-cn-ext.c @@ -27,6 +27,7 @@ #include "cns11643.h" #include "cns11643l1.h" #include "cns11643l2.h" +#include <libc-internal.h> #include <assert.h> @@ -394,6 +395,16 @@ enum #define MIN_NEEDED_OUTPUT TO_LOOP_MIN_NEEDED_TO #define MAX_NEEDED_OUTPUT TO_LOOP_MAX_NEEDED_TO #define LOOPFCT TO_LOOP +/* With GCC 5.3 when compiling with -Os the compiler emits a warning + that buf[0] and buf[1] may be used uninitialized. This can only + happen in the case where tmpbuf[3] is used, and in that case the + write to the tmpbuf[1] and tmpbuf[2] was assured because + ucs4_to_cns11643 would have filled in those entries. The difficulty + is in getting the compiler to see this logic because tmpbuf[0] is + involved in determining the code page and is the indicator that + tmpbuf[2] is initialized. */ +DIAG_PUSH_NEEDS_COMMENT; +DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized"); #define BODY \ { \ uint32_t ch; \ @@ -645,6 +656,7 @@ enum /* Now that we wrote the output increment the input pointer. */ \ inptr += 4; \ } +DIAG_POP_NEEDS_COMMENT; #define EXTRA_LOOP_DECLS , int *setp #define INIT_PARAMS int set = (*setp >> 3) & CURRENT_MASK; \ int ann = (*setp >> 3) & ~CURRENT_MASK |