Commit 594bb0e7 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (have_extern_spec): Declare it

	* cp-tree.h (have_extern_spec): Declare it
	* decl.c (have_extern_spec): Define it.
	(start_decl): Eliminate use of used_extern_spec.
	(start_function): Likewise.
	* parse.y (have_extern_spec): Remove declaration.
	(used_extern_spec): Likewise.
	(frob_specs): Eliminate use of used_extern_spec.
	(.hush_warning): Likewise.

From-SVN: r55319
parent 974a90cf
2002-07-08 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (have_extern_spec): Declare it
* decl.c (have_extern_spec): Define it.
(start_decl): Eliminate use of used_extern_spec.
(start_function): Likewise.
* parse.y (have_extern_spec): Remove declaration.
(used_extern_spec): Likewise.
(frob_specs): Eliminate use of used_extern_spec.
(.hush_warning): Likewise.
2002-07-07 Mark Mitchell <mark@codesourcery.com> 2002-07-07 Mark Mitchell <mark@codesourcery.com>
* Make-lang.in (cp/parse.o): Depend on decl.h. * Make-lang.in (cp/parse.o): Depend on decl.h.
......
...@@ -3904,6 +3904,7 @@ extern tree declare_global_var PARAMS ((tree, tree)); ...@@ -3904,6 +3904,7 @@ extern tree declare_global_var PARAMS ((tree, tree));
extern void register_dtor_fn PARAMS ((tree)); extern void register_dtor_fn PARAMS ((tree));
extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int)); extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int));
extern tree cp_fname_init PARAMS ((const char *)); extern tree cp_fname_init PARAMS ((const char *));
extern bool have_extern_spec;
/* in decl2.c */ /* in decl2.c */
extern int check_java_method PARAMS ((tree)); extern int check_java_method PARAMS ((tree));
......
...@@ -306,6 +306,11 @@ static enum deprecated_states deprecated_state = DEPRECATED_NORMAL; ...@@ -306,6 +306,11 @@ static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
being flagged as deprecated or reported as using deprecated being flagged as deprecated or reported as using deprecated
types. */ types. */
int adding_implicit_members = 0; int adding_implicit_members = 0;
/* True if a declaration with an `extern' linkage specifier is being
processed. */
bool have_extern_spec;
/* For each binding contour we allocate a binding_level structure /* For each binding contour we allocate a binding_level structure
which records the names defined in that contour. which records the names defined in that contour.
...@@ -7193,8 +7198,6 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) ...@@ -7193,8 +7198,6 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
tree decl; tree decl;
register tree type, tem; register tree type, tem;
tree context; tree context;
extern int have_extern_spec;
extern int used_extern_spec;
#if 0 #if 0
/* See code below that used this. */ /* See code below that used this. */
...@@ -7202,11 +7205,11 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) ...@@ -7202,11 +7205,11 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
#endif #endif
/* This should only be done once on the top most decl. */ /* This should only be done once on the top most decl. */
if (have_extern_spec && !used_extern_spec) if (have_extern_spec)
{ {
declspecs = tree_cons (NULL_TREE, get_identifier ("extern"), declspecs = tree_cons (NULL_TREE, get_identifier ("extern"),
declspecs); declspecs);
used_extern_spec = 1; have_extern_spec = false;
} }
/* An object declared as __attribute__((deprecated)) suppresses /* An object declared as __attribute__((deprecated)) suppresses
...@@ -13501,8 +13504,6 @@ start_function (declspecs, declarator, attrs, flags) ...@@ -13501,8 +13504,6 @@ start_function (declspecs, declarator, attrs, flags)
tree ctype = NULL_TREE; tree ctype = NULL_TREE;
tree fntype; tree fntype;
tree restype; tree restype;
extern int have_extern_spec;
extern int used_extern_spec;
int doing_friend = 0; int doing_friend = 0;
struct cp_binding_level *bl; struct cp_binding_level *bl;
tree current_function_parms; tree current_function_parms;
...@@ -13512,10 +13513,10 @@ start_function (declspecs, declarator, attrs, flags) ...@@ -13512,10 +13513,10 @@ start_function (declspecs, declarator, attrs, flags)
my_friendly_assert (TREE_CHAIN (void_list_node) == NULL_TREE, 161); my_friendly_assert (TREE_CHAIN (void_list_node) == NULL_TREE, 161);
/* This should only be done once on the top most decl. */ /* This should only be done once on the top most decl. */
if (have_extern_spec && !used_extern_spec) if (have_extern_spec)
{ {
declspecs = tree_cons (NULL_TREE, get_identifier ("extern"), declspecs); declspecs = tree_cons (NULL_TREE, get_identifier ("extern"), declspecs);
used_extern_spec = 1; have_extern_spec = false;
} }
if (flags & SF_PRE_PARSED) if (flags & SF_PRE_PARSED)
......
...@@ -98,10 +98,6 @@ do { \ ...@@ -98,10 +98,6 @@ do { \
error message if the user supplies an empty conditional expression. */ error message if the user supplies an empty conditional expression. */
static const char *cond_stmt_keyword; static const char *cond_stmt_keyword;
/* Nonzero if we have an `extern "C"' acting as an extern specifier. */
int have_extern_spec;
int used_extern_spec;
/* List of types and structure classes of the current declaration. */ /* List of types and structure classes of the current declaration. */
static GTY(()) tree current_declspecs; static GTY(()) tree current_declspecs;
...@@ -163,7 +159,7 @@ frob_specs (specs_attrs, lookups) ...@@ -163,7 +159,7 @@ frob_specs (specs_attrs, lookups)
if (current_declspecs if (current_declspecs
&& TREE_CODE (current_declspecs) != TREE_LIST) && TREE_CODE (current_declspecs) != TREE_LIST)
current_declspecs = build_tree_list (NULL_TREE, current_declspecs); current_declspecs = build_tree_list (NULL_TREE, current_declspecs);
if (have_extern_spec && !used_extern_spec) if (have_extern_spec)
{ {
/* We have to indicate that there is an "extern", but that it /* We have to indicate that there is an "extern", but that it
was part of a language specifier. For instance, was part of a language specifier. For instance,
...@@ -174,7 +170,7 @@ frob_specs (specs_attrs, lookups) ...@@ -174,7 +170,7 @@ frob_specs (specs_attrs, lookups)
current_declspecs = tree_cons (error_mark_node, current_declspecs = tree_cons (error_mark_node,
get_identifier ("extern"), get_identifier ("extern"),
current_declspecs); current_declspecs);
used_extern_spec = 1; have_extern_spec = false;
} }
} }
...@@ -510,12 +506,11 @@ extdefs_opt: ...@@ -510,12 +506,11 @@ extdefs_opt:
; ;
.hush_warning: .hush_warning:
{ have_extern_spec = 1; { have_extern_spec = true;
used_extern_spec = 0;
$<ttype>$ = NULL_TREE; } $<ttype>$ = NULL_TREE; }
; ;
.warning_ok: .warning_ok:
{ have_extern_spec = 0; } { have_extern_spec = false; }
; ;
extension: extension:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment