Commit 5b030314 by Nathan Sidwell Committed by Nathan Sidwell

c-tree.h (define_label): Replace filename and lineno arguments with a location_t.

	* c-tree.h (define_label): Replace filename and lineno arguments
	with a location_t.
	* c-decl.c (poplevel): Adjust define_label call.
	(pop_label_level): Likewise.
	(define_label): Replace filename and lineno arguments with a
	location_t.
	(store_parm_decls): Use DECL_SOURCE_LOCATION.
	* c-parse.in (label): Adjust define_label call.

	* cp/cp-tree.h (define_label): Replace filename and lineno
	arguments with a location_t.
	* cp/decl.c (pop_label): Adjust define_label call.
	(define_label): Replace filename and lineno arguments with a
	location_t.
	* cp/semantics.c (finish_label): Adjust define_label call.

	* java/decl.c (poplevel): Adjust define_label call.

From-SVN: r68766
parent c9bdad35
2003-07-01 Nathan Sidwell <nathan@codesourcery.com>
* c-tree.h (define_label): Replace filename and lineno arguments
with a location_t.
* c-decl.c (poplevel): Adjust define_label call.
(pop_label_level): Likewise.
(define_label): Replace filename and lineno arguments with a
location_t.
(store_parm_decls): Use DECL_SOURCE_LOCATION.
* c-parse.in (label): Adjust define_label call.
2003-07-01 Neil Booth <neil@daikokuya.co.uk> 2003-07-01 Neil Booth <neil@daikokuya.co.uk>
* config/sol2.h, config/alpha/alpha.h, config/alpha/linux.h, * config/sol2.h, config/alpha/alpha.h, config/alpha/linux.h,
......
...@@ -607,8 +607,7 @@ poplevel (int keep, int reverse, int functionbody) ...@@ -607,8 +607,7 @@ poplevel (int keep, int reverse, int functionbody)
{ {
error_with_decl (label, "label `%s' used but not defined"); error_with_decl (label, "label `%s' used but not defined");
/* Avoid crashing later. */ /* Avoid crashing later. */
define_label (input_filename, input_line, define_label (input_location, DECL_NAME (label));
DECL_NAME (label));
} }
else if (warn_unused_label && !TREE_USED (label)) else if (warn_unused_label && !TREE_USED (label))
warning_with_decl (label, "label `%s' defined but not used"); warning_with_decl (label, "label `%s' defined but not used");
...@@ -699,8 +698,7 @@ pop_label_level (void) ...@@ -699,8 +698,7 @@ pop_label_level (void)
error_with_decl (TREE_VALUE (link), error_with_decl (TREE_VALUE (link),
"label `%s' used but not defined"); "label `%s' used but not defined");
/* Avoid crashing later. */ /* Avoid crashing later. */
define_label (input_filename, input_line, define_label (input_location, DECL_NAME (TREE_VALUE (link)));
DECL_NAME (TREE_VALUE (link)));
} }
else if (warn_unused_label && !TREE_USED (TREE_VALUE (link))) else if (warn_unused_label && !TREE_USED (TREE_VALUE (link)))
warning_with_decl (TREE_VALUE (link), warning_with_decl (TREE_VALUE (link),
...@@ -2055,12 +2053,9 @@ shadow_label (tree name) ...@@ -2055,12 +2053,9 @@ shadow_label (tree name)
Otherwise return 0. */ Otherwise return 0. */
tree tree
define_label (const char* filename, int line, tree name) define_label (location_t location, tree name)
{ {
location_t locus;
tree decl = lookup_label (name); tree decl = lookup_label (name);
locus.file = filename;
locus.line = line;
/* If label with this name is known from an outer context, shadow it. */ /* If label with this name is known from an outer context, shadow it. */
if (decl != 0 && DECL_CONTEXT (decl) != current_function_decl) if (decl != 0 && DECL_CONTEXT (decl) != current_function_decl)
...@@ -2072,11 +2067,11 @@ define_label (const char* filename, int line, tree name) ...@@ -2072,11 +2067,11 @@ define_label (const char* filename, int line, tree name)
if (warn_traditional && !in_system_header && lookup_name (name)) if (warn_traditional && !in_system_header && lookup_name (name))
warning ("%Htraditional C lacks a separate namespace for labels, " warning ("%Htraditional C lacks a separate namespace for labels, "
"identifier `%s' conflicts", &locus, IDENTIFIER_POINTER (name)); "identifier `%s' conflicts", &location, IDENTIFIER_POINTER (name));
if (DECL_INITIAL (decl) != 0) if (DECL_INITIAL (decl) != 0)
{ {
error ("%Hduplicate label `%s'", &locus, IDENTIFIER_POINTER (name)); error ("%Hduplicate label `%s'", &location, IDENTIFIER_POINTER (name));
return 0; return 0;
} }
else else
...@@ -2084,7 +2079,7 @@ define_label (const char* filename, int line, tree name) ...@@ -2084,7 +2079,7 @@ define_label (const char* filename, int line, tree name)
/* Mark label as having been defined. */ /* Mark label as having been defined. */
DECL_INITIAL (decl) = error_mark_node; DECL_INITIAL (decl) = error_mark_node;
/* Say where in the source. */ /* Say where in the source. */
DECL_SOURCE_LOCATION (decl) = locus; DECL_SOURCE_LOCATION (decl) = location;
return decl; return decl;
} }
} }
...@@ -5879,8 +5874,7 @@ store_parm_decls (void) ...@@ -5879,8 +5874,7 @@ store_parm_decls (void)
found = build_decl (PARM_DECL, TREE_VALUE (parm), found = build_decl (PARM_DECL, TREE_VALUE (parm),
integer_type_node); integer_type_node);
DECL_ARG_TYPE (found) = TREE_TYPE (found); DECL_ARG_TYPE (found) = TREE_TYPE (found);
DECL_SOURCE_LINE (found) = DECL_SOURCE_LINE (fndecl); DECL_SOURCE_LOCATION (found) = DECL_SOURCE_LOCATION (fndecl);
DECL_SOURCE_FILE (found) = DECL_SOURCE_FILE (fndecl);
if (flag_isoc99) if (flag_isoc99)
pedwarn_with_decl (found, "type of `%s' defaults to `int'"); pedwarn_with_decl (found, "type of `%s' defaults to `int'");
else if (extra_warnings) else if (extra_warnings)
......
...@@ -2446,7 +2446,7 @@ label: CASE expr_no_commas ':' ...@@ -2446,7 +2446,7 @@ label: CASE expr_no_commas ':'
{ stmt_count++; { stmt_count++;
$$ = do_case (NULL_TREE, NULL_TREE); } $$ = do_case (NULL_TREE, NULL_TREE); }
| identifier save_location ':' maybe_attribute | identifier save_location ':' maybe_attribute
{ tree label = define_label ($2.file, $2.line, $1); { tree label = define_label ($2, $1);
stmt_count++; stmt_count++;
if (label) if (label)
{ {
......
...@@ -189,7 +189,7 @@ extern void check_for_loop_decls (void); ...@@ -189,7 +189,7 @@ extern void check_for_loop_decls (void);
extern void clear_parm_order (void); extern void clear_parm_order (void);
extern int complete_array_type (tree, tree, int); extern int complete_array_type (tree, tree, int);
extern void declare_parm_level (int); extern void declare_parm_level (int);
extern tree define_label (const char *, int, tree); extern tree define_label (location_t, tree);
extern void finish_decl (tree, tree, tree); extern void finish_decl (tree, tree, tree);
extern tree finish_enum (tree, tree, tree); extern tree finish_enum (tree, tree, tree);
extern void finish_function (int, int); extern void finish_function (int, int);
......
2003-07-01 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (define_label): Replace filename and lineno
arguments with a location_t.
* decl.c (pop_label): Adjust define_label call.
(define_label): Replace filename and lineno arguments with a
location_t.
* semantics.c (finish_label): Adjust define_label call.
2003-07-01 Mark Mitchell <mark@codesourcery.com> 2003-07-01 Mark Mitchell <mark@codesourcery.com>
PR c++/9559 PR c++/9559
......
...@@ -3650,7 +3650,7 @@ extern tree push_using_directive (tree); ...@@ -3650,7 +3650,7 @@ extern tree push_using_directive (tree);
extern bool push_class_level_binding (tree, tree); extern bool push_class_level_binding (tree, tree);
extern tree implicitly_declare (tree); extern tree implicitly_declare (tree);
extern tree declare_local_label (tree); extern tree declare_local_label (tree);
extern tree define_label (const char *, int, tree); extern tree define_label (location_t, tree);
extern void check_goto (tree); extern void check_goto (tree);
extern void define_case_label (void); extern void define_case_label (void);
extern tree namespace_binding (tree, tree); extern tree namespace_binding (tree, tree);
......
...@@ -1175,9 +1175,13 @@ pop_label (tree label, tree old_value) ...@@ -1175,9 +1175,13 @@ pop_label (tree label, tree old_value)
{ {
if (DECL_INITIAL (label) == NULL_TREE) if (DECL_INITIAL (label) == NULL_TREE)
{ {
location_t location;
cp_error_at ("label `%D' used but not defined", label); cp_error_at ("label `%D' used but not defined", label);
location.file = input_filename;
location.line = 0;
/* Avoid crashing later. */ /* Avoid crashing later. */
define_label (input_filename, 1, DECL_NAME (label)); define_label (location, DECL_NAME (label));
} }
else if (warn_unused_label && !TREE_USED (label)) else if (warn_unused_label && !TREE_USED (label))
cp_warning_at ("label `%D' defined but not used", label); cp_warning_at ("label `%D' defined but not used", label);
...@@ -4939,7 +4943,7 @@ check_goto (tree decl) ...@@ -4939,7 +4943,7 @@ check_goto (tree decl)
Otherwise return 0. */ Otherwise return 0. */
tree tree
define_label (const char* filename, int line, tree name) define_label (location_t location, tree name)
{ {
tree decl = lookup_label (name); tree decl = lookup_label (name);
struct named_label_list *ent; struct named_label_list *ent;
...@@ -4968,8 +4972,7 @@ define_label (const char* filename, int line, tree name) ...@@ -4968,8 +4972,7 @@ define_label (const char* filename, int line, tree name)
/* Mark label as having been defined. */ /* Mark label as having been defined. */
DECL_INITIAL (decl) = error_mark_node; DECL_INITIAL (decl) = error_mark_node;
/* Say where in the source. */ /* Say where in the source. */
DECL_SOURCE_FILE (decl) = filename; DECL_SOURCE_LOCATION (decl) = location;
DECL_SOURCE_LINE (decl) = line;
if (ent) if (ent)
{ {
ent->names_in_scope = current_binding_level->names; ent->names_in_scope = current_binding_level->names;
......
...@@ -1136,7 +1136,7 @@ finish_asm_stmt (tree cv_qualifier, ...@@ -1136,7 +1136,7 @@ finish_asm_stmt (tree cv_qualifier,
tree tree
finish_label_stmt (tree name) finish_label_stmt (tree name)
{ {
tree decl = define_label (input_filename, input_line, name); tree decl = define_label (input_location, name);
return add_stmt (build_stmt (LABEL_STMT, decl)); return add_stmt (build_stmt (LABEL_STMT, decl));
} }
......
2003-07-01 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (poplevel): Adjust define_label call.
2003-06-27 Zack Weinberg <zack@codesourcery.com> 2003-06-27 Zack Weinberg <zack@codesourcery.com>
* gjavah.c (flag_jni): Make non-static. * gjavah.c (flag_jni): Make non-static.
......
...@@ -1366,8 +1366,7 @@ poplevel (int keep, int reverse, int functionbody) ...@@ -1366,8 +1366,7 @@ poplevel (int keep, int reverse, int functionbody)
{ {
error_with_decl (label, "label `%s' used but not defined"); error_with_decl (label, "label `%s' used but not defined");
/* Avoid crashing later. */ /* Avoid crashing later. */
define_label (input_filename, lineno, define_label (input_location, DECL_NAME (label));
DECL_NAME (label));
} }
else if (warn_unused[UNUSED_LABEL] && !TREE_USED (label)) else if (warn_unused[UNUSED_LABEL] && !TREE_USED (label))
warning_with_decl (label, "label `%s' defined but not used"); warning_with_decl (label, "label `%s' defined but not used");
......
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