aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-06-09 20:33:51 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-06-09 20:33:51 +0000
commitd7ff7ae55410b6566f2e65843f69dc41e8c9c87e (patch)
tree92fa4e29eb5d8ccef0c7ca0f2d1bbf5232779d5c /gcc/c
parent23646391f243274745cf31e66d914061570a4c45 (diff)
downloadgcc-d7ff7ae55410b6566f2e65843f69dc41e8c9c87e.zip
gcc-d7ff7ae55410b6566f2e65843f69dc41e8c9c87e.tar.gz
gcc-d7ff7ae55410b6566f2e65843f69dc41e8c9c87e.tar.bz2
re PR c/36446 (unexplained warning in struct initialization)
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. * gcc.dg/Wcxx-compat-6.c: Change dg-warning to dg-message. * gcc.dg/array-2.c: Likewise. * gcc.dg/array-const-2.c: Likewise. * gcc.dg/ucnid-8.c: Likewise. * gcc.dg/vla-init-1.c: Likewise. * gcc.dg/array-const-3.c: Change dg-error to dg-message. * gcc.dg/c99-flex-array-7.c: Likewise. * gcc.dg/init-bad-1.c: Likewise. * gcc.dg/init-bad-3.c: Likewise. * gcc.dg/init-bad-2.c: Change dg-error and dg-warning to dg-message. * gcc.dg/pedwarn-init.c: Add dg-warning. * gcc.dg/pr53119.c: Remove dg-excess-errors. From-SVN: r211388
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog7
-rw-r--r--gcc/c/c-typeck.c16
2 files changed, 16 insertions, 7 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 47cf3cc..86372fa 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 e4fa0c3..63bd65e 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