Skip to content

Commit

Permalink
Silence some false positive warnings for gcc 4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Metcalf committed Jan 21, 2016
1 parent a314083 commit 2a9feb9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2016-01-20 Chris Metcalf <cmetcalf@ezchip.com>

* nis/nis_table.c (__follow_path): Disable diagnostic for
uninitialized variable that is a false positive for gcc 4.7.
* stdio-common/vfscanf.c (_IO_vfwscanf): Likewise.

2016-01-20 Roland McGrath <roland@hack.frob.com>

* sysdeps/nacl/lowlevellock-futex.h
Expand Down
9 changes: 9 additions & 0 deletions nis/nis_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <assert.h>
#include <string.h>
#include <rpcsvc/nis.h>
#include <libc-internal.h>

#include "nis_xdr.h"
#include "nis_intern.h"
Expand Down Expand Up @@ -175,13 +176,21 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,

*tableptr = *tablepath;
}

/* Since tableptr is only set here, and it's set when tablepath is NULL,
which it is initially defined as, we know it will always be set here. */
DIAG_PUSH_NEEDS_COMMENT;
DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");

if (*tableptr == NULL)
return NIS_NOTFOUND;

char *newname = strsep (tableptr, ":");
if (newname[0] == '\0')
return NIS_NOTFOUND;

DIAG_POP_NEEDS_COMMENT;

newname = strdup (newname);
if (newname == NULL)
return NIS_NOMEMORY;
Expand Down
10 changes: 10 additions & 0 deletions stdio-common/vfscanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <string.h>
#include <wchar.h>
#include <wctype.h>
#include <libc-internal.h>
#include <libc-lock.h>
#include <locale/localeinfo.h>
#include <scratch_buffer.h>
Expand Down Expand Up @@ -1535,13 +1536,22 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* Get the string for the digits with value N. */
#ifdef COMPILE_WSCANF

/* wcdigits_extended[] is fully set in the loop
above, but the test for "map != NULL" is done
inside the loop here and outside the loop there. */
DIAG_PUSH_NEEDS_COMMENT;
DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");

if (__glibc_unlikely (map != NULL))
wcdigits[n] = wcdigits_extended[n];
else
wcdigits[n] = (const wchar_t *)
_NL_CURRENT (LC_CTYPE, _NL_CTYPE_INDIGITS0_WC + n);
wcdigits[n] += from_level;

DIAG_POP_NEEDS_COMMENT;

if (c == (wint_t) *wcdigits[n])
{
to_level = from_level;
Expand Down

0 comments on commit 2a9feb9

Please sign in to comment.