Commit 84df082b by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (UPT_TEMPLATE): Remove.

	* cp-tree.h (UPT_TEMPLATE): Remove.
	(UPT_PARMS): Likewise.
	(DECL_NEEDED_P): New macro.
	* decl2.c (finish_vtable_vardecl): Use it.
	(finish_objects): Don't crash with -fsyntax-only.
	(finish_file): Use DECL_NEEDED_P.  Don't prune vtables when
	-fsyntax-only.
	* pt.c (tsubst_friend_function): Remove FIXME that talks about
	obstacks.
	(tsubst_expr): Correct handling of function try-blocks.
	* semantics.c: Include flags.h.
	(expand_body): Don't do RTL generation if -fsyntax-only.
	* Makefile.in (semantics.o): Depends on flags.h.

From-SVN: r29705
parent ddb34a29
1999-09-29 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (UPT_TEMPLATE): Remove.
(UPT_PARMS): Likewise.
(DECL_NEEDED_P): New macro.
* decl2.c (finish_vtable_vardecl): Use it.
(finish_objects): Don't crash with -fsyntax-only.
(finish_file): Use DECL_NEEDED_P. Don't prune vtables when
-fsyntax-only.
* pt.c (tsubst_friend_function): Remove FIXME that talks about
obstacks.
(tsubst_expr): Correct handling of function try-blocks.
* semantics.c: Include flags.h.
(expand_body): Don't do RTL generation if -fsyntax-only.
* Makefile.in (semantics.o): Depends on flags.h.
1999-09-28 Gabriel Dos Reis <gdr@codesourcery.com> 1999-09-28 Gabriel Dos Reis <gdr@codesourcery.com>
* pt.c (most_general_template): Adjust declaration. * pt.c (most_general_template): Adjust declaration.
......
...@@ -294,7 +294,8 @@ errfn.o : errfn.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ ...@@ -294,7 +294,8 @@ errfn.o : errfn.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../ggc.h $(srcdir)/../toplev.h $(srcdir)/../ggc.h
semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \ semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \
$(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
$(srcdir)/../flags.h
dump.o: dump.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h dump.o: dump.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h
# #
......
...@@ -2494,9 +2494,13 @@ extern int flag_new_for_scope; ...@@ -2494,9 +2494,13 @@ extern int flag_new_for_scope;
#define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i) #define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
/* ...and for unexpanded-parameterized-type nodes. */ /* DECL_NEEDED_P holds of a declaration when we need to emit its
#define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE)) definition. This is true when the back-end tells us that
#define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE)) the symbol has been referenced in the generated code. If, however,
we are not generating code, then it is also true when a symbol has
just been used somewhere, even if it's not really needed. */
#define DECL_NEEDED_P(DECL) \
(TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME ((DECL)))) \
/* An un-parsed default argument looks like an identifier. */ /* An un-parsed default argument looks like an identifier. */
#define DEFARG_LENGTH(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.length) #define DEFARG_LENGTH(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.length)
......
...@@ -2556,7 +2556,7 @@ finish_vtable_vardecl (t, data) ...@@ -2556,7 +2556,7 @@ finish_vtable_vardecl (t, data)
if (! DECL_EXTERNAL (vars) if (! DECL_EXTERNAL (vars)
&& (DECL_INTERFACE_KNOWN (vars) && (DECL_INTERFACE_KNOWN (vars)
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars)) || DECL_NEEDED_P (vars)
|| (hack_decl_function_context (vars) && TREE_USED (vars))) || (hack_decl_function_context (vars) && TREE_USED (vars)))
&& ! TREE_ASM_WRITTEN (vars)) && ! TREE_ASM_WRITTEN (vars))
{ {
...@@ -2600,9 +2600,14 @@ finish_vtable_vardecl (t, data) ...@@ -2600,9 +2600,14 @@ finish_vtable_vardecl (t, data)
if (flag_vtable_gc) if (flag_vtable_gc)
output_vtable_inherit (vars); output_vtable_inherit (vars);
/* Because we're only doing syntax-checking, we'll never end up
actually marking the variable as written. */
if (flag_syntax_only)
TREE_ASM_WRITTEN (vars) = 1;
return 1; return 1;
} }
else if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars))) else if (!DECL_NEEDED_P (vars))
/* We don't know what to do with this one yet. */ /* We don't know what to do with this one yet. */
return 0; return 0;
...@@ -2827,6 +2832,12 @@ finish_objects (method_type, initp, body) ...@@ -2827,6 +2832,12 @@ finish_objects (method_type, initp, body)
fn = finish_function (lineno, 0); fn = finish_function (lineno, 0);
expand_body (fn); expand_body (fn);
/* When only doing semantic analysis, and no RTL generation, we
can't call functions that directly emit assembly code; there is
no assembly file in which to put the code. */
if (flag_syntax_only)
return;
fnname = XSTR (XEXP (DECL_RTL (fn), 0), 0); fnname = XSTR (XEXP (DECL_RTL (fn), 0), 0);
if (initp == DEFAULT_INIT_PRIORITY) if (initp == DEFAULT_INIT_PRIORITY)
{ {
...@@ -2835,7 +2846,6 @@ finish_objects (method_type, initp, body) ...@@ -2835,7 +2846,6 @@ finish_objects (method_type, initp, body)
else else
assemble_destructor (fnname); assemble_destructor (fnname);
} }
#if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR) #if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR)
/* If we're using init priority we can't use assemble_*tor, but on ELF /* If we're using init priority we can't use assemble_*tor, but on ELF
targets we can stick the references into named sections for GNU ld targets we can stick the references into named sections for GNU ld
...@@ -3554,8 +3564,7 @@ finish_file () ...@@ -3554,8 +3564,7 @@ finish_file ()
if (DECL_NOT_REALLY_EXTERN (decl) if (DECL_NOT_REALLY_EXTERN (decl)
&& DECL_INITIAL (decl) && DECL_INITIAL (decl)
&& (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) && (DECL_NEEDED_P (decl) || !DECL_COMDAT (decl)))
|| !DECL_COMDAT (decl)))
DECL_EXTERNAL (decl) = 0; DECL_EXTERNAL (decl) = 0;
} }
...@@ -3603,8 +3612,10 @@ finish_file () ...@@ -3603,8 +3612,10 @@ finish_file ()
/* Now delete from the chain of variables all virtual function tables. /* Now delete from the chain of variables all virtual function tables.
We output them all ourselves, because each will be treated We output them all ourselves, because each will be treated
specially. */ specially. We don't do this if we're just doing semantic
walk_globals (vtable_decl_p, prune_vtable_vardecl, /*data=*/0); analysis, and not code-generation. */
if (!flag_syntax_only)
walk_globals (vtable_decl_p, prune_vtable_vardecl, /*data=*/0);
/* Now, issue warnings about static, but not defined, functions, /* Now, issue warnings about static, but not defined, functions,
etc., and emit debugging information. */ etc., and emit debugging information. */
......
...@@ -4549,8 +4549,6 @@ tsubst_friend_function (decl, args) ...@@ -4549,8 +4549,6 @@ tsubst_friend_function (decl, args)
tsubst (DECL_TI_ARGS (decl), tsubst (DECL_TI_ARGS (decl),
args, /*complain=*/1, args, /*complain=*/1,
NULL_TREE)); NULL_TREE));
/* FIXME: The decl we create via the next tsubst could be
created on a temporary obstack. */
new_friend = tsubst (decl, args, /*complain=*/1, NULL_TREE); new_friend = tsubst (decl, args, /*complain=*/1, NULL_TREE);
tmpl = determine_specialization (template_id, new_friend, tmpl = determine_specialization (template_id, new_friend,
&new_args, &new_args,
...@@ -7466,7 +7464,10 @@ tsubst_expr (t, args, complain, in_decl) ...@@ -7466,7 +7464,10 @@ tsubst_expr (t, args, complain, in_decl)
handler = TRY_HANDLERS (t); handler = TRY_HANDLERS (t);
for (; handler; handler = TREE_CHAIN (handler)) for (; handler; handler = TREE_CHAIN (handler))
tsubst_expr (handler, args, complain, in_decl); tsubst_expr (handler, args, complain, in_decl);
finish_handler_sequence (stmt); if (FN_TRY_BLOCK_P (t))
finish_function_handler_sequence (stmt);
else
finish_handler_sequence (stmt);
} }
break; break;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "except.h" #include "except.h"
#include "lex.h" #include "lex.h"
#include "toplev.h" #include "toplev.h"
#include "flags.h"
/* There routines provide a modular interface to perform many parsing /* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or operations. They may therefore be used during actual parsing, or
...@@ -2488,8 +2489,13 @@ expand_body (fn) ...@@ -2488,8 +2489,13 @@ expand_body (fn)
&& uses_template_parms (DECL_TI_ARGS (fn)))) && uses_template_parms (DECL_TI_ARGS (fn))))
return; return;
/* There's no reason to do any of the work here if we're only doing
semantic analysis; this code just generates RTL. */
if (flag_syntax_only)
return;
/* Save the current file name and line number. When we expand the /* Save the current file name and line number. When we expand the
body of the funciton, we'll set LINENO and INPUT_FILENAME so that body of the function, we'll set LINENO and INPUT_FILENAME so that
error-mesages come out in the right places. */ error-mesages come out in the right places. */
saved_lineno = lineno; saved_lineno = lineno;
saved_input_filename = input_filename; saved_input_filename = input_filename;
......
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