aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-05-02 18:09:42 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-05-02 18:09:42 +0000
commit19fc9faaaf98b3c45ede31da2e3cb970ef7b372a (patch)
tree071af8206b3e246f7368ae1b77b50da2d378bf6f /gcc/c
parent6577374eaa1de4e387f4a67c300133922dd52707 (diff)
downloadgcc-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/c')
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/c/c-typeck.c12
2 files changed, 12 insertions, 4 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index e3c13fe..b32e4fd 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,9 @@
2014-05-02 Marek Polacek <polacek@redhat.com>
+ * c-typeck.c (c_finish_return): Separate warning_at calls.
+
+2014-05-02 Marek Polacek <polacek@redhat.com>
+
* c-tree.h (error_init): Remove declaration.
(pedwarn_init): Likewise.
* c-typeck.c (error_init): Make static and move above.
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index b95fd89..f7ad91e 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -9273,10 +9273,14 @@ c_finish_return (location_t loc, tree retval, tree origtype)
&& !DECL_EXTERNAL (inner)
&& !TREE_STATIC (inner)
&& DECL_CONTEXT (inner) == current_function_decl)
- warning_at (loc,
- OPT_Wreturn_local_addr, "function returns address "
- "of %s", TREE_CODE (inner) == LABEL_DECL
- ? "label" : "local variable");
+ {
+ if (TREE_CODE (inner) == LABEL_DECL)
+ warning_at (loc, OPT_Wreturn_local_addr,
+ "function returns address of label");
+ else
+ warning_at (loc, OPT_Wreturn_local_addr,
+ "function returns address of local variable");
+ }
break;
default: