diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-29 23:21:35 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-29 23:21:35 +0000 |
commit | 8b447d3f4f8509f90a13d4aa2fd435b84ff517f4 (patch) | |
tree | cc94a67e7b17460335b8b668eac1f55a166543ed /gcc/c-family | |
parent | d75cece1a80023500084e21c3dc9209d6891fb60 (diff) | |
download | gcc-8b447d3f4f8509f90a13d4aa2fd435b84ff517f4.tar.gz |
gcc/c-family:
PR c++/54930
* c.opt (Wreturn_local_addr): Define new option.
gcc/c:
PR c++/54930
* c-typeck.c (c_finish_return): Use OPT_Wreturn_local_addr.
gcc/cp:
PR c++/54930
* typeck.c (maybe_warn_about_returning_address_of_local): Use
OPT_Wreturn_local_addr.
gcc:
PR c++/54930
* doc/invoke.texi (Warning Options): Document -Wno-return-local-addr.
gcc/testsuite:
PR c++/54930
* gcc.dg/Wreturn-local-addr.c: New.
* g++.dg/warn/Wno-return-local-addr.C: New.
* g++.dg/warn/Wreturn-local-addr.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192968 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index f97057ec2c5..f7c942216bc 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2012-10-29 Jonathan Wakely <jwakely.gcc@gmail.com> + + PR c++/54930 + * c.opt (Wreturn_local_addr): Define new option. + 2012-10-25 Jason Merrill <jason@redhat.com> * c.opt (Wvirtual-move-assign): New. diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 7eb66c6175b..06d6e363c98 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -613,6 +613,10 @@ Wreorder C++ ObjC++ Var(warn_reorder) Warning LangEnabledBy(C++ ObjC++,Wall) Warn when the compiler reorders code +Wreturn-local-addr +C ObjC C++ ObjC++ Var(warn_return_local_addr) Init(1) Warning +Warn about returning a pointer/reference to a local or temporary variable. + Wreturn-type C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++) |