diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 47cf3cc3093..86372fa3035 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2014-06-09 Marek Polacek <polacek@redhat.com> + + PR c/36446 + * c-typeck.c (error_init): Call inform instead of error_at. + (pedwarn_init): Call inform instead of pedwarn. + (warning_init): Call inform instead of warning_at. + 2014-06-07 Jan Hubicka <hubicka@ucw.cz> * c-decl.c (merge_decls): Use set_decl_section_name. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index e4fa0c3b4bc..63bd65ee0be 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -5567,7 +5567,7 @@ error_init (location_t loc, const char *gmsgid) error_at (loc, gmsgid); ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); if (*ofwhat) - error_at (loc, "(near initialization for %qs)", ofwhat); + inform (loc, "(near initialization for %qs)", ofwhat); } /* Issue a pedantic warning for a bad initializer component. OPT is @@ -5579,12 +5579,13 @@ static void pedwarn_init (location_t location, int opt, const char *gmsgid) { char *ofwhat; + bool warned; /* The gmsgid may be a format string with %< and %>. */ - pedwarn (location, opt, gmsgid); + warned = pedwarn (location, opt, gmsgid); ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); - if (*ofwhat) - pedwarn (location, opt, "(near initialization for %qs)", ofwhat); + if (*ofwhat && warned) + inform (location, "(near initialization for %qs)", ofwhat); } /* Issue a warning for a bad initializer component. @@ -5597,12 +5598,13 @@ static void warning_init (location_t loc, int opt, const char *gmsgid) { char *ofwhat; + bool warned; /* The gmsgid may be a format string with %< and %>. */ - warning_at (loc, opt, gmsgid); + warned = warning_at (loc, opt, gmsgid); ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); - if (*ofwhat) - warning_at (loc, opt, "(near initialization for %qs)", ofwhat); + if (*ofwhat && warned) + inform (loc, "(near initialization for %qs)", ofwhat); } /* If TYPE is an array type and EXPR is a parenthesized string |