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 /resolv/res_send.c | |
parent | 960294f00a33559af40143ac056f68d21c006d27 (diff) | |
download | glibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.zip glibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.tar.gz glibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.tar.bz2 |
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 'resolv/res_send.c')
-rw-r--r-- | resolv/res_send.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c index 6d46bb2..4ec8c1a 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -664,7 +664,7 @@ send_vc(res_state statp, a false-positive. */ DIAG_PUSH_NEEDS_COMMENT; - DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized"); + DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized"); int resplen; DIAG_POP_NEEDS_COMMENT; struct iovec iov[4]; @@ -930,7 +930,16 @@ reopen (res_state statp, int *terrno, int ns) * error message is received. We can thus detect * the absence of a nameserver without timing out. */ + /* With GCC 5.3 when compiling with -Os the compiler + emits a warning that slen may be used uninitialized, + but that is never true. Both slen and + EXT(statp).nssocks[ns] are initialized together or + the function return -1 before control flow reaches + the call to connect with slen. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized"); if (connect(EXT(statp).nssocks[ns], nsap, slen) < 0) { + DIAG_POP_NEEDS_COMMENT; Aerror(statp, stderr, "connect(dg)", errno, nsap); __res_iclose(statp, false); return (0); |