diff options
author | Marek Polacek <polacek@redhat.com> | 2014-05-02 18:09:42 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-05-02 18:09:42 +0000 |
commit | 19fc9faaaf98b3c45ede31da2e3cb970ef7b372a (patch) | |
tree | 071af8206b3e246f7368ae1b77b50da2d378bf6f /gcc/cp | |
parent | 6577374eaa1de4e387f4a67c300133922dd52707 (diff) | |
download | gcc-19fc9faaaf98b3c45ede31da2e3cb970ef7b372a.zip gcc-19fc9faaaf98b3c45ede31da2e3cb970ef7b372a.tar.gz gcc-19fc9faaaf98b3c45ede31da2e3cb970ef7b372a.tar.bz2 |
c-typeck.c (c_finish_return): Separate warning_at calls.
c/
* c-typeck.c (c_finish_return): Separate warning_at calls.
cp/
* typeck.c (maybe_warn_about_returning_address_of_local): Separate
warning_at calls.
From-SVN: r210012
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4d16855..7729cb9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-05-02 Marek Polacek <polacek@redhat.com> + + * typeck.c (maybe_warn_about_returning_address_of_local): Separate + warning_at calls. + 2014-05-01 Marek Polacek <polacek@redhat.com> PR c/43395 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 8b7cb8d..7b28a9a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8309,10 +8309,12 @@ maybe_warn_about_returning_address_of_local (tree retval) if (TREE_CODE (valtype) == REFERENCE_TYPE) warning (OPT_Wreturn_local_addr, "reference to local variable %q+D returned", whats_returned); + else if (TREE_CODE (whats_returned) == LABEL_DECL) + warning (OPT_Wreturn_local_addr, "address of label %q+D returned", + whats_returned); else - warning (OPT_Wreturn_local_addr, "address of %s %q+D returned", - TREE_CODE (whats_returned) == LABEL_DECL - ? "label" : "local variable", whats_returned); + warning (OPT_Wreturn_local_addr, "address of local variable %q+D " + "returned", whats_returned); return; } } |