Commit 124b18d0 authored by nathan's avatar nathan
Browse files

* c-parse.in (%union): Replace filename & lineno with location.

	(save_filename, save_lineno): Remove.
	(save_location): New.
	(fndef, old_style_parm_decls_1, lineno_datadecl, lineno_decl,
	nested_function, notype_nested_function, if_prefix, lineno_stmt,
	lineno_label, label): Adjust.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68636 138bc75d-0d04-0410-961f-82ee72b054a4
parent c09841f6
2003-06-28 Nathan Sidwell <nathan@codesourcery.com>
* c-parse.in (%union): Replace filename & lineno with location.
(save_filename, save_lineno): Remove.
(save_location): New.
(fndef, old_style_parm_decls_1, lineno_datadecl, lineno_decl,
nested_function, notype_nested_function, if_prefix, lineno_stmt,
lineno_label, label): Adjust.
2003-06-28 Jakub Jelinek <jakub@redhat.com> 2003-06-28 Jakub Jelinek <jakub@redhat.com>
   
* builtins.c (c_strlen): Add only_value argument. * builtins.c (c_strlen): Add only_value argument.
......
...@@ -108,7 +108,7 @@ do { \ ...@@ -108,7 +108,7 @@ do { \
%start program %start program
%union {long itype; tree ttype; enum tree_code code; %union {long itype; tree ttype; enum tree_code code;
const char *filename; int lineno; } location_t location; }
/* All identifiers that are not reserved words /* All identifiers that are not reserved words
and are not declared typedefs in the current block */ and are not declared typedefs in the current block */
...@@ -238,8 +238,7 @@ do { \ ...@@ -238,8 +238,7 @@ do { \
%type <itype> setspecs setspecs_fp %type <itype> setspecs setspecs_fp
%type <filename> save_filename %type <location> save_location
%type <lineno> save_lineno
ifobjc ifobjc
/* the Objective-C nonterminals */ /* the Objective-C nonterminals */
...@@ -434,11 +433,10 @@ fndef: ...@@ -434,11 +433,10 @@ fndef:
all_prefix_attributes)) all_prefix_attributes))
YYERROR1; YYERROR1;
} }
old_style_parm_decls save_filename save_lineno old_style_parm_decls save_location
{ DECL_SOURCE_FILE (current_function_decl) = $6; { DECL_SOURCE_LOCATION (current_function_decl) = $6;
DECL_SOURCE_LINE (current_function_decl) = $7;
store_parm_decls (); } store_parm_decls (); }
compstmt_or_error compstmt_or_error
{ finish_function (0, 1); { finish_function (0, 1);
POP_DECLSPEC_STACK; } POP_DECLSPEC_STACK; }
| declspecs_ts setspecs declarator error | declspecs_ts setspecs declarator error
...@@ -448,9 +446,8 @@ fndef: ...@@ -448,9 +446,8 @@ fndef:
all_prefix_attributes)) all_prefix_attributes))
YYERROR1; YYERROR1;
} }
old_style_parm_decls save_filename save_lineno old_style_parm_decls save_location
{ DECL_SOURCE_FILE (current_function_decl) = $6; { DECL_SOURCE_LOCATION (current_function_decl) = $6;
DECL_SOURCE_LINE (current_function_decl) = $7;
store_parm_decls (); } store_parm_decls (); }
compstmt_or_error compstmt_or_error
{ finish_function (0, 1); { finish_function (0, 1);
...@@ -462,9 +459,8 @@ fndef: ...@@ -462,9 +459,8 @@ fndef:
all_prefix_attributes)) all_prefix_attributes))
YYERROR1; YYERROR1;
} }
old_style_parm_decls save_filename save_lineno old_style_parm_decls save_location
{ DECL_SOURCE_FILE (current_function_decl) = $5; { DECL_SOURCE_LOCATION (current_function_decl) = $5;
DECL_SOURCE_LINE (current_function_decl) = $6;
store_parm_decls (); } store_parm_decls (); }
compstmt_or_error compstmt_or_error
{ finish_function (0, 1); { finish_function (0, 1);
...@@ -805,7 +801,7 @@ old_style_parm_decls_1: ...@@ -805,7 +801,7 @@ old_style_parm_decls_1:
except that they do not allow nested functions. except that they do not allow nested functions.
They are used for old-style parm decls. */ They are used for old-style parm decls. */
lineno_datadecl: lineno_datadecl:
save_filename save_lineno datadecl save_location datadecl
{ } { }
; ;
...@@ -837,7 +833,7 @@ datadecl: ...@@ -837,7 +833,7 @@ datadecl:
This is to avoid shift/reduce conflicts in contexts This is to avoid shift/reduce conflicts in contexts
where statement labels are allowed. */ where statement labels are allowed. */
lineno_decl: lineno_decl:
save_filename save_lineno decl save_location decl
{ } { }
; ;
...@@ -1593,10 +1589,9 @@ nested_function: ...@@ -1593,10 +1589,9 @@ nested_function:
} }
parsing_iso_function_signature = false; /* Don't warn about nested functions. */ parsing_iso_function_signature = false; /* Don't warn about nested functions. */
} }
old_style_parm_decls save_filename save_lineno old_style_parm_decls save_location
{ tree decl = current_function_decl; { tree decl = current_function_decl;
DECL_SOURCE_FILE (decl) = $4; DECL_SOURCE_LOCATION (decl) = $4;
DECL_SOURCE_LINE (decl) = $5;
store_parm_decls (); } store_parm_decls (); }
/* This used to use compstmt_or_error. /* This used to use compstmt_or_error.
That caused a bug with input `f(g) int g {}', That caused a bug with input `f(g) int g {}',
...@@ -1625,10 +1620,9 @@ notype_nested_function: ...@@ -1625,10 +1620,9 @@ notype_nested_function:
} }
parsing_iso_function_signature = false; /* Don't warn about nested functions. */ parsing_iso_function_signature = false; /* Don't warn about nested functions. */
} }
old_style_parm_decls save_filename save_lineno old_style_parm_decls save_location
{ tree decl = current_function_decl; { tree decl = current_function_decl;
DECL_SOURCE_FILE (decl) = $4; DECL_SOURCE_LOCATION (decl) = $4;
DECL_SOURCE_LINE (decl) = $5;
store_parm_decls (); } store_parm_decls (); }
/* This used to use compstmt_or_error. /* This used to use compstmt_or_error.
That caused a bug with input `f(g) int g {}', That caused a bug with input `f(g) int g {}',
...@@ -2233,8 +2227,7 @@ if_prefix: ...@@ -2233,8 +2227,7 @@ if_prefix:
{ c_expand_start_cond (c_common_truthvalue_conversion ($4), { c_expand_start_cond (c_common_truthvalue_conversion ($4),
compstmt_count,$<ttype>2); compstmt_count,$<ttype>2);
$<itype>$ = stmt_count; $<itype>$ = stmt_count;
if_stmt_locus.file = $<filename>-2; if_stmt_locus = $<location>-1; }
if_stmt_locus.line = $<lineno>-1; }
; ;
/* This is a subroutine of stmt. /* This is a subroutine of stmt.
...@@ -2260,16 +2253,11 @@ do_stmt_start: ...@@ -2260,16 +2253,11 @@ do_stmt_start:
/* The forced readahead in here is because we might be at the end of a /* The forced readahead in here is because we might be at the end of a
line, and the line and file won't be bumped until yylex absorbs the line, and the line and file won't be bumped until yylex absorbs the
first token on the next line. */ first token on the next line. */
save_filename:
{ if (yychar == YYEMPTY)
yychar = YYLEX;
$$ = input_filename; }
;
save_lineno: save_location:
{ if (yychar == YYEMPTY) { if (yychar == YYEMPTY)
yychar = YYLEX; yychar = YYLEX;
$$ = input_line; } $$ = input_location; }
; ;
lineno_labeled_stmt: lineno_labeled_stmt:
...@@ -2285,10 +2273,10 @@ c99_block_lineno_labeled_stmt: ...@@ -2285,10 +2273,10 @@ c99_block_lineno_labeled_stmt:
; ;
lineno_stmt: lineno_stmt:
save_filename save_lineno stmt save_location stmt
{ if ($3) { if ($2)
{ {
STMT_LINENO ($3) = $2; STMT_LINENO ($2) = $1.line;
/* ??? We currently have no way of recording /* ??? We currently have no way of recording
the filename for a statement. This probably the filename for a statement. This probably
matters little in practice at the moment, matters little in practice at the moment,
...@@ -2299,10 +2287,10 @@ lineno_stmt: ...@@ -2299,10 +2287,10 @@ lineno_stmt:
; ;
lineno_label: lineno_label:
save_filename save_lineno label save_location label
{ if ($3) { if ($2)
{ {
STMT_LINENO ($3) = $2; STMT_LINENO ($2) = $1.line;
} }
} }
; ;
...@@ -2457,12 +2445,12 @@ label: CASE expr_no_commas ':' ...@@ -2457,12 +2445,12 @@ label: CASE expr_no_commas ':'
| DEFAULT ':' | DEFAULT ':'
{ stmt_count++; { stmt_count++;
$$ = do_case (NULL_TREE, NULL_TREE); } $$ = do_case (NULL_TREE, NULL_TREE); }
| identifier save_filename save_lineno ':' maybe_attribute | identifier save_location ':' maybe_attribute
{ tree label = define_label ($2, $3, $1); { tree label = define_label ($2.file, $2.line, $1);
stmt_count++; stmt_count++;
if (label) if (label)
{ {
decl_attributes (&label, $5, 0); decl_attributes (&label, $4, 0);
$$ = add_stmt (build_stmt (LABEL_STMT, label)); $$ = add_stmt (build_stmt (LABEL_STMT, label));
} }
else else
......
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