OSDN Git Service

C++ support for -Wunused-but-set-variable
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 May 2010 06:52:30 +0000 (06:52 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 May 2010 06:52:30 +0000 (06:52 +0000)
commitfbb73d9bb6980aacb2366cbde38d255de0fde0fe
tree98529df86d4f96b7809a5e235901996abf394d3f
parent29b41aee3398389086f39a5b6c3eb012d72f8db0
C++ support for -Wunused-but-set-variable

gcc/cp/ChangeLog:
PR 18624
* cp-tree.h (mark_exp_read, mark_rvalue_use, mark_lvalue_use,
mark_type_use): Declare ...
* expr.c (mark_exp_read, mark_rvalue_use, mark_lvalue_use,
mark_type_use): ... new fns.
* typeck.c (cxx_sizeof_expr, cxx_alignof_expr): Call mark_type_use.
(perform_integral_promotions): Call mark_rvalue_use.
(cp_build_unary_op): Call mark_lvalue_use.
(decay_conversion): Update comment. Call mark_lvalue.
* decl.c (unused_but_set_errorcount): New variable.
(poplevel): Issue -Wunused-but-set-variable diagnostics.
(duplicate_decls): Merge DECL_READ_P flags.
(start_cleanup_fn): Set DECL_READ_P flag.
(finish_function): Issue -Wunused-but-set-parameter diagnostics.
* tree.c (rvalue): Call mark_rvalue_use.
* pt.c (convert_nontype_argument): Likewise.
* semantics.c (finish_typeof, finish_decltype_type): Call
mark_type_use.
(finish_asm_stmt): Call mark_lvalue_use.
(finish_expr_stmt): Call mark_exp_read.
* call.c (convert_like_real) <ck_identity, ck_user>: Call
mark_rvalue_use.
(build_x_va_arg): Call mark_lvalue_use.
(build_over_call): Call mark_type_use.
* init.c (build_new, build_delete): Call mark_value_use.
* rtti.c (build_typeid): Call mark_lvalue_use or mark_type_use.
(build_dynamic_cast_1): call mark_lvalue_use or mark_rvalue_use.

gcc/testsuite/ChangeLog:
PR 18624
* g++.dg/warn/Wunused-7.C: Add dg-warning.
* g++.dg/template/sfinae16.C: Likewise.
* gcc.dg/Wunused-var-1.c: Moved to...
* c-c++-common/Wunused-var-1.c: ...here. New test.
* gcc.dg/Wunused-var-2.c: Moved to...
* c-c++-common/Wunused-var-2.c: ...here. New test.
* gcc.dg/Wunused-var-3.c: Moved to...
* c-c++-common/Wunused-var-3.c: ...here. New test.
* gcc.dg/Wunused-var-4.c: Moved to...
* gcc.dg/Wunused-var-1.c: ... here.
* gcc.dg/Wunused-var-5.c: Moved to...
* c-c++-common/Wunused-var-4.c: ...here. New test.
* gcc.dg/Wunused-var-7.c: Moved to...
* c-c++-common/Wunused-var-5.c: ...here. New test.
* gcc.dg/Wunused-var-6.c: Moved to...
* gcc.dg/Wunused-var-2.c: ... here.
* c-c++-common/Wunused-var-1.c: New test.
* c-c++-common/Wunused-var-2.c: New test.
* c-c++-common/Wunused-var-3.c: New test.
* c-c++-common/Wunused-var-4.c: New test.
* c-c++-common/Wunused-var-5.c: New test.
* g++.dg/warn/Wunused-var-1.C: New test.
* g++.dg/warn/Wunused-var-2.C: New test.
* g++.dg/warn/Wunused-var-3.C: New test.
* g++.dg/warn/Wunused-var-4.C: New test.
* g++.dg/warn/Wunused-var-5.C: New test.
* g++.dg/warn/Wunused-var-6.C: New test.
* g++.dg/warn/Wunused-var-7.C: New test.
* g++.dg/warn/Wunused-var-8.C: New test.
* g++.dg/warn/Wunused-parm-1.C: New test.
* g++.dg/warn/Wunused-parm-2.C: New test.
* g++.dg/warn/Wunused-parm-3.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159096 138bc75d-0d04-0410-961f-82ee72b054a4
35 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/except.c
gcc/cp/expr.c
gcc/cp/init.c
gcc/cp/pt.c
gcc/cp/rtti.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wunused-var-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/Wunused-var-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/Wunused-var-3.c [moved from gcc/testsuite/gcc.dg/Wunused-var-3.c with 100% similarity]
gcc/testsuite/c-c++-common/Wunused-var-4.c [moved from gcc/testsuite/gcc.dg/Wunused-var-7.c with 80% similarity]
gcc/testsuite/c-c++-common/Wunused-var-5.c [moved from gcc/testsuite/gcc.dg/Wunused-var-5.c with 100% similarity]
gcc/testsuite/g++.dg/template/sfinae16.C
gcc/testsuite/g++.dg/warn/Wunused-7.C
gcc/testsuite/g++.dg/warn/Wunused-parm-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-parm-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-parm-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-8.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wunused-var-1.c
gcc/testsuite/gcc.dg/Wunused-var-2.c
gcc/testsuite/gcc.dg/Wunused-var-4.c [deleted file]
gcc/testsuite/gcc.dg/Wunused-var-6.c [deleted file]