* 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
+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>
* pt.c (most_general_template): Adjust declaration.
repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../ggc.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
#\f
#define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
-/* ...and for unexpanded-parameterized-type nodes. */
-#define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE))
-#define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE))
+/* DECL_NEEDED_P holds of a declaration when we need to emit its
+ definition. This is true when the back-end tells us that
+ 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. */
#define DEFARG_LENGTH(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.length)
if (! DECL_EXTERNAL (vars)
&& (DECL_INTERFACE_KNOWN (vars)
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars))
+ || DECL_NEEDED_P (vars)
|| (hack_decl_function_context (vars) && TREE_USED (vars)))
&& ! TREE_ASM_WRITTEN (vars))
{
if (flag_vtable_gc)
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;
}
- 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. */
return 0;
fn = finish_function (lineno, 0);
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);
if (initp == DEFAULT_INIT_PRIORITY)
{
else
assemble_destructor (fnname);
}
-
#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
targets we can stick the references into named sections for GNU ld
if (DECL_NOT_REALLY_EXTERN (decl)
&& DECL_INITIAL (decl)
- && (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
- || !DECL_COMDAT (decl)))
+ && (DECL_NEEDED_P (decl) || !DECL_COMDAT (decl)))
DECL_EXTERNAL (decl) = 0;
}
/* Now delete from the chain of variables all virtual function tables.
We output them all ourselves, because each will be treated
- specially. */
- walk_globals (vtable_decl_p, prune_vtable_vardecl, /*data=*/0);
+ specially. We don't do this if we're just doing semantic
+ 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,
etc., and emit debugging information. */
tsubst (DECL_TI_ARGS (decl),
args, /*complain=*/1,
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);
tmpl = determine_specialization (template_id, new_friend,
&new_args,
handler = TRY_HANDLERS (t);
for (; handler; handler = TREE_CHAIN (handler))
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;
#include "except.h"
#include "lex.h"
#include "toplev.h"
+#include "flags.h"
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
&& uses_template_parms (DECL_TI_ARGS (fn))))
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
- 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. */
saved_lineno = lineno;
saved_input_filename = input_filename;