Commit b190f239 by Nathan Sidwell Committed by Nathan Sidwell

c-parse.in (fndef): Set DECL_SOURCE_LINE and FILE earlier.

	* c-parse.in (fndef): Set DECL_SOURCE_LINE and FILE earlier.
	(nested_function): Likewise.
	(notype_nested_function): Likewise.
cp:
	* pt.c (register_specialization): Update the decl's location,
	if necessary.
	(check_explicit_specialization): Likewise.

From-SVN: r67063
parent 278566a2
2003-05-21 Nathan Sidwell <nathan@codesourcery.com>
* c-parse.in (fndef): Set DECL_SOURCE_LINE and FILE earlier.
(nested_function): Likewise.
(notype_nested_function): Likewise.
2003-05-21 Nick Clifton <nickc@redhat.com> 2003-05-21 Nick Clifton <nickc@redhat.com>
* config/stormy16/stormy-abi: Update overflow type for * config/stormy16/stormy-abi: Update overflow type for
......
...@@ -434,12 +434,12 @@ fndef: ...@@ -434,12 +434,12 @@ fndef:
all_prefix_attributes)) all_prefix_attributes))
YYERROR1; YYERROR1;
} }
old_style_parm_decls old_style_parm_decls save_filename save_lineno
{ store_parm_decls (); } { DECL_SOURCE_FILE (current_function_decl) = $6;
save_filename save_lineno compstmt_or_error DECL_SOURCE_LINE (current_function_decl) = $7;
{ DECL_SOURCE_FILE (current_function_decl) = $7; store_parm_decls (); }
DECL_SOURCE_LINE (current_function_decl) = $8; 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
{ POP_DECLSPEC_STACK; } { POP_DECLSPEC_STACK; }
...@@ -448,12 +448,12 @@ fndef: ...@@ -448,12 +448,12 @@ fndef:
all_prefix_attributes)) all_prefix_attributes))
YYERROR1; YYERROR1;
} }
old_style_parm_decls old_style_parm_decls save_filename save_lineno
{ store_parm_decls (); } { DECL_SOURCE_FILE (current_function_decl) = $6;
save_filename save_lineno compstmt_or_error DECL_SOURCE_LINE (current_function_decl) = $7;
{ DECL_SOURCE_FILE (current_function_decl) = $7; store_parm_decls (); }
DECL_SOURCE_LINE (current_function_decl) = $8; compstmt_or_error
finish_function (0, 1); { finish_function (0, 1);
POP_DECLSPEC_STACK; } POP_DECLSPEC_STACK; }
| declspecs_nots setspecs notype_declarator error | declspecs_nots setspecs notype_declarator error
{ POP_DECLSPEC_STACK; } { POP_DECLSPEC_STACK; }
...@@ -462,12 +462,12 @@ fndef: ...@@ -462,12 +462,12 @@ fndef:
all_prefix_attributes)) all_prefix_attributes))
YYERROR1; YYERROR1;
} }
old_style_parm_decls old_style_parm_decls save_filename save_lineno
{ store_parm_decls (); } { DECL_SOURCE_FILE (current_function_decl) = $5;
save_filename save_lineno compstmt_or_error DECL_SOURCE_LINE (current_function_decl) = $6;
{ DECL_SOURCE_FILE (current_function_decl) = $6; store_parm_decls (); }
DECL_SOURCE_LINE (current_function_decl) = $7; compstmt_or_error
finish_function (0, 1); { finish_function (0, 1);
POP_DECLSPEC_STACK; } POP_DECLSPEC_STACK; }
| setspecs notype_declarator error | setspecs notype_declarator error
{ POP_DECLSPEC_STACK; } { POP_DECLSPEC_STACK; }
...@@ -1593,18 +1593,19 @@ nested_function: ...@@ -1593,18 +1593,19 @@ 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 old_style_parm_decls save_filename save_lineno
{ store_parm_decls (); } { tree decl = current_function_decl;
DECL_SOURCE_FILE (decl) = $4;
DECL_SOURCE_LINE (decl) = $5;
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 {}',
where the use of YYERROR1 above caused an error where the use of YYERROR1 above caused an error
which then was handled by compstmt_or_error. which then was handled by compstmt_or_error.
There followed a repeated execution of that same rule, There followed a repeated execution of that same rule,
which called YYERROR1 again, and so on. */ which called YYERROR1 again, and so on. */
save_filename save_lineno compstmt compstmt
{ tree decl = current_function_decl; { tree decl = current_function_decl;
DECL_SOURCE_FILE (decl) = $5;
DECL_SOURCE_LINE (decl) = $6;
finish_function (1, 1); finish_function (1, 1);
pop_function_context (); pop_function_context ();
add_decl_stmt (decl); } add_decl_stmt (decl); }
...@@ -1624,18 +1625,19 @@ notype_nested_function: ...@@ -1624,18 +1625,19 @@ 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 old_style_parm_decls save_filename save_lineno
{ store_parm_decls (); } { tree decl = current_function_decl;
DECL_SOURCE_FILE (decl) = $4;
DECL_SOURCE_LINE (decl) = $5;
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 {}',
where the use of YYERROR1 above caused an error where the use of YYERROR1 above caused an error
which then was handled by compstmt_or_error. which then was handled by compstmt_or_error.
There followed a repeated execution of that same rule, There followed a repeated execution of that same rule,
which called YYERROR1 again, and so on. */ which called YYERROR1 again, and so on. */
save_filename save_lineno compstmt compstmt
{ tree decl = current_function_decl; { tree decl = current_function_decl;
DECL_SOURCE_FILE (decl) = $5;
DECL_SOURCE_LINE (decl) = $6;
finish_function (1, 1); finish_function (1, 1);
pop_function_context (); pop_function_context ();
add_decl_stmt (decl); } add_decl_stmt (decl); }
......
2003-05-21 Nathan Sidwell <nathan@codesourcery.com>
* pt.c (register_specialization): Update the decl's location,
if necessary.
(check_explicit_specialization): Likewise.
2003-05-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-05-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* error.c (dump_expr): Use HOST_WIDE_INT_PRINT_DOUBLE_HEX. * error.c (dump_expr): Use HOST_WIDE_INT_PRINT_DOUBLE_HEX.
......
...@@ -1041,7 +1041,12 @@ register_specialization (spec, tmpl, args) ...@@ -1041,7 +1041,12 @@ register_specialization (spec, tmpl, args)
} }
else if (DECL_TEMPLATE_SPECIALIZATION (fn)) else if (DECL_TEMPLATE_SPECIALIZATION (fn))
{ {
duplicate_decls (spec, fn); if (!duplicate_decls (spec, fn) && DECL_INITIAL (spec))
/* Dup decl failed, but this is a new
definition. Set the line number so any errors
match this new definition. */
DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (spec);
return fn; return fn;
} }
} }
...@@ -1851,6 +1856,12 @@ check_explicit_specialization (declarator, decl, template_count, flags) ...@@ -1851,6 +1856,12 @@ check_explicit_specialization (declarator, decl, template_count, flags)
{ {
SET_DECL_TEMPLATE_SPECIALIZATION (tmpl); SET_DECL_TEMPLATE_SPECIALIZATION (tmpl);
DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE; DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE;
if (have_def)
{
DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl);
DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl))
= DECL_SOURCE_LOCATION (decl);
}
return tmpl; return tmpl;
} }
......
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