aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-tree.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-04-07 20:33:36 +0000
committerJakub Jelinek <jakub@redhat.com>2010-04-07 20:33:36 +0000
commitb4976c6247868443df05a67a39995e576c2d9a6d (patch)
tree2559870c4c1dbe82ba98485de0b41abd6bed7ca2 /gcc/c-tree.h
parentbe05f357ee6d0f6b4b2dc9a017e0f1b9fa5e7c2c (diff)
PR c/18624
* tree.h (DECL_READ_P): Define. (struct tree_decl_common): Add decl_read_flag. * c-decl.c (pop_scope): If TREE_USED but !DECL_READ_P, issue a set but not used warning. (merge_decls): Merge DECL_READ_P flag. (finish_decl, build_compound_literal): Set DECL_READ_P flag. (finish_function): Issue -Wunused-but-set-parameter diagnostics. * c-common.c (handle_used_attribute, handle_unused_attribute): Likewise. * c-tree.h (default_function_array_read_conversion, mark_exp_read): New prototypes. * c-typeck.c (default_function_array_read_conversion, mark_exp_read): New functions. (default_conversion, c_process_expr_stmt): Call mark_exp_read. * c-parser.c (c_parser_initializer, c_parser_expr_no_commas, c_parser_binary_expression, c_parser_cast_expression, c_parser_expr_list, c_parser_omp_atomic, c_parser_omp_for_loop): Call default_function_array_read_conversion instead of default_function_array_conversion where needed. (c_parser_unary_expression, c_parser_conditional_expression, c_parser_postfix_expression_after_primary, c_parser_initelt): Likewise. Call mark_exp_read where needed. (c_parser_statement_after_labels, c_parser_asm_operands, c_parser_typeof_specifier, c_parser_sizeof_expression, c_parser_alignof_expression, c_parser_initval): Call mark_exp_read where needed. * common.opt (Wunused-but-set-variable, Wunused-but-set-parameter): New. * toplev.c (warn_unused_but_set_variable): Default to warn_unused. (warn_unused_but_set_parameter): Default to warn_unused && extra_warnings. * doc/invoke.texi: Document -Wunused-but-set-variable and -Wunused-but-set-parameter. * objc-act.c (finish_var_decl, objc_begin_catch_clause, really_start_method, get_super_receiver, handle_class_ref): Set DECL_READ_P in addition to TREE_USED. * gcc.dg/Wunused-var-1.c: New test. * gcc.dg/Wunused-var-2.c: New test. * gcc.dg/Wunused-var-3.c: New test. * gcc.dg/Wunused-var-4.c: New test. * gcc.dg/Wunused-var-5.c: New test. * gcc.dg/Wunused-var-6.c: New test. * gcc.dg/Wunused-parm-1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@158086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-tree.h')
-rw-r--r--gcc/c-tree.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index dab9d39175e..3681ed7dfec 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -1,6 +1,6 @@
/* Definitions for C parsing and type checking.
Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -511,7 +511,10 @@ extern bool c_mark_addressable (tree);
extern void c_incomplete_type_error (const_tree, const_tree);
extern tree c_type_promotes_to (tree);
extern struct c_expr default_function_array_conversion (location_t,
- struct c_expr);
+ struct c_expr);
+extern struct c_expr default_function_array_read_conversion (location_t,
+ struct c_expr);
+extern void mark_exp_read (tree);
extern tree composite_type (tree, tree);
extern tree build_component_ref (location_t, tree, tree);
extern tree build_array_ref (location_t, tree, tree);