diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-09 01:16:16 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-09 01:16:16 +0000 |
commit | 9823d3a9a666d8459764265abd3b04ead5c3def1 (patch) | |
tree | cafc9cbafbe798461e115c710492d5167b17d34a /gcc/c-tree.h | |
parent | 196bfa93bdbc9ac2c3e3f5104b6774bbbce7c150 (diff) | |
download | ppe42-gcc-9823d3a9a666d8459764265abd3b04ead5c3def1.tar.gz ppe42-gcc-9823d3a9a666d8459764265abd3b04ead5c3def1.zip |
* c-tree.h (C_DECL_USED, parser_obstack, in_alignof, in_sizeof,
in_typeof, record_maybe_used_decl, pop_maybe_used,
c_expr_sizeof_expr, c_expr_sizeof_type): New.
* c-decl.c (parser_obstack): New.
(c_init_decl_processing): Initialize parser_obstack.
(c_write_global_declarations_1): Check for used but undefined
static functions.
* c-parse.in (%union): Add otype.
(save_obstack_position): New.
(extdefs): Use it.
(unary_expr): Update in_sizeof and in_alignof. Use
c_expr_sizeof_expr and c_expr_sizeof_type.
(sizeof): Update in_sizeof.
(alignof): Update in_alignof.
(typeof): Update in_typeof.
(typespec_nonreserved_nonattr): Call pop_maybe_used.
* c-typeck.c (in_alignof, in_sizeof, in_typeof, struct
maybe_used_decl, maybe_used_decls, record_maybe_used_decl,
pop_maybe_used, c_expr_sizeof_expr, c_expr_sizeof_type): New.
(build_external_ref): Set C_DECL_USED or call
record_maybe_used_decl if appropriate.
* toplev.c (check_global_declarations): Check TREE_NO_WARNING.
testsuite:
* gcc.dg/c90-static-1.c, gcc.dg/c99-static-1.c,
gcc.dg/gnu99-static-1.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87216 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-tree.h')
-rw-r--r-- | gcc/c-tree.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 104fe0c4c7f..e241d4bddea 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -99,6 +99,12 @@ struct lang_type GTY(()) they may differ for structures with volatile fields. */ #define C_DECL_REGISTER(EXP) DECL_LANG_FLAG_4 (EXP) +/* Record whether a decl was used in an expression anywhere except an + unevaluated operand of sizeof / typeof / alignof. This is only + used for functions declared static but not defined, though outside + sizeof and typeof it is set for other function decls as well. */ +#define C_DECL_USED(EXP) DECL_LANG_FLAG_5 (EXP) + /* Nonzero for a decl which either doesn't exist or isn't a prototype. N.B. Could be simplified if all built-in decls had complete prototypes (but this is presently difficult because some of them need FILE*). */ @@ -151,6 +157,7 @@ extern void c_parse_init (void); extern void gen_aux_info_record (tree, int, int, int); /* in c-decl.c */ +extern struct obstack parser_obstack; extern tree c_break_label; extern tree c_cont_label; @@ -224,6 +231,10 @@ extern void c_initialize_diagnostics (diagnostic_context *); ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0)) /* in c-typeck.c */ +extern int in_alignof; +extern int in_sizeof; +extern int in_typeof; + extern struct c_switch *c_switch_stack; extern tree require_complete_type (tree); @@ -238,6 +249,10 @@ extern tree build_component_ref (tree, tree); extern tree build_indirect_ref (tree, const char *); extern tree build_array_ref (tree, tree); extern tree build_external_ref (tree, int); +extern void record_maybe_used_decl (tree); +extern void pop_maybe_used (bool); +extern struct c_expr c_expr_sizeof_expr (struct c_expr); +extern struct c_expr c_expr_sizeof_type (tree); extern struct c_expr parser_build_binary_op (enum tree_code, struct c_expr, struct c_expr); extern void readonly_error (tree, const char *); |