* Makefile.in (c-parse.o, c-common.o): Update dependencies.
* c-common.c: Include diagnostic.h.
(c_common_finish): New.
* c-common.h (c_common_finish): New.
* c-lang.c (LANG_HOOKS_FINISH): Override.
* c-parse.in: Don't include diagnostic.h.
(finish_parse): Remove.
* langhooks.h: Update comments.
* toplev.c (lang_dependent_init): New prototype.
(finalize): New.
(compile_file): Split cleanup code out to finalize.
(lang_dependent_init): Stop if lang_hooks.init fails.
(toplev_main): Update.
* tree.h (finish_parse): Remove.
ada: * misc.c (gnat_decode_option, gnat_init_options): Make definitions
static too.
(gnat_init): Don't return NULL.
(finish_parse): Remove.
cp: * lex.c (cxx_finish): Call c_common_finish.
(finish_parse): Remove.
f: * com.c (finish_parse): Remove.
(ffe_finish): Move body of finish_parse.
java: * lang.c (finish_parse): Rename to java_finish.
(LANG_HOOKS_FINISH, java_finish): New.
objc: * objc-act.c (LANG_HOOKS_FINISH): Override.
From-SVN: r47141
+2001-11-18 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * Makefile.in (c-parse.o, c-common.o): Update dependencies.
+ * c-common.c: Include diagnostic.h.
+ (c_common_finish): New.
+ * c-common.h (c_common_finish): New.
+ * c-lang.c (LANG_HOOKS_FINISH): Override.
+ * c-parse.in: Don't include diagnostic.h.
+ (finish_parse): Remove.
+ * langhooks.h: Update comments.
+ * toplev.c (lang_dependent_init): New prototype.
+ (finalize): New.
+ (compile_file): Split cleanup code out to finalize.
+ (lang_dependent_init): Stop if lang_hooks.init fails.
+ (toplev_main): Update.
+ * tree.h (finish_parse): Remove.
+objc:
+ * objc-act.c (LANG_HOOKS_FINISH): Override.
+
Sat Nov 17 23:30:44 2001 Douglas B. Rupp <rupp@gnat.com>
* config/alpha/t-vms (LIB2FUNCS_EXTRA): Add vms_tramp.asm.
+2001-11-18 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * misc.c (gnat_decode_option, gnat_init_options): Make definitions
+ static too.
+ (gnat_init): Don't return NULL.
+ (finish_parse): Remove.
+
2001-11-17 Laurent Guerby <guerby@acm.org>
* Make-lang.in (GNATLIBFLAGS): Add -W -Wall.
* *
* C Implementation File *
* *
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
* *
* Copyright (C) 1992-2001 Free Software Foundation, Inc. *
* *
it cannot decode. This routine returns 1 if it is successful, otherwise
it returns 0. */
-int
+static int
gnat_decode_option (argc, argv)
int argc ATTRIBUTE_UNUSED;
char **argv;
/* Initialize for option processing. */
-void
+static void
gnat_init_options ()
{
/* Initialize gnat_argv with save_argv size */
dwarf2out_set_demangle_name_func (convert_ada_name_to_qualified_name);
#endif
+ if (filename == 0)
+ filename = "";
+
return filename;
}
}
}
-void
-finish_parse ()
-{
-}
-
#if 0
/* Return the alignment for GNAT_TYPE. */
#include "ggc.h"
#include "expr.h"
#include "c-common.h"
+#include "diagnostic.h"
#include "tm_p.h"
#include "obstack.h"
#include "c-lex.h"
return filename;
}
+/* Common finish hook for the C, ObjC and C++ front ends. */
+void
+c_common_finish ()
+{
+ cpp_finish (parse_in);
+
+ /* For performance, avoid tearing down cpplib's internal structures.
+ Call cpp_errors () instead of cpp_destroy (). */
+ errorcount += cpp_errors (parse_in);
+}
+
static void
c_init_attributes ()
{
extern tree build_va_arg PARAMS ((tree, tree));
extern const char *c_common_lang_init PARAMS ((const char *));
+extern void c_common_finish PARAMS ((void));
extern HOST_WIDE_INT c_common_get_alias_set PARAMS ((tree));
extern bool c_promoting_integer_type_p PARAMS ((tree));
extern int self_promoting_args_p PARAMS ((tree));
#define LANG_HOOKS_NAME "GNU C"
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT c_init
+#undef LANG_HOOKS_FINISH
+#define LANG_HOOKS_FINISH c_common_finish
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS c_init_options
#undef LANG_HOOKS_DECODE_OPTION
#include "output.h"
#include "toplev.h"
#include "ggc.h"
-#include "diagnostic.h"
#ifdef MULTIBYTE_CHARS
#include <locale.h>
}
}
-void
-finish_parse ()
-{
- cpp_finish (parse_in);
- /* Call to cpp_destroy () omitted for performance reasons. */
- errorcount += cpp_errors (parse_in);
-}
-
#define NAME(type) cpp_type2name (type)
static void
+2001-11-18 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * lex.c (cxx_finish): Call c_common_finish.
+ (finish_parse): Remove.
+
2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* decl.c (create_array_type_for_decl): Check if NAME is NULL_TREE
cxx_finish ()
{
if (flag_gnu_xref)
- GNU_xref_end (errorcount+sorrycount);
+ GNU_xref_end (errorcount + sorrycount);
+ c_common_finish ();
}
static int *
return filename;
}
-
-void
-finish_parse ()
-{
- cpp_finish (parse_in);
- /* Call to cpp_destroy () omitted for performance reasons. */
- errorcount += cpp_errors (parse_in);
-}
\f
inline void
yyprint (file, yychar, yylval)
+Sun Nov 18 11:13:04 2001 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * com.c (finish_parse): Remove.
+ (ffe_finish): Move body of finish_parse.
+
Thu Nov 15 10:06:38 2001 Neil Booth <neil@daikokuya.demon.co.uk>
* com.c (ffecom_init_decl_processing): Renamed from
ffe_init_0 ();
}
-void
-finish_parse ()
-{
- fclose (finput);
-}
-
/* Delete the node BLOCK from the current binding level.
This is used for the block inside a stmt expr ({...})
so that the block can be reinserted where appropriate. */
if (ffe_is_ffedebug ())
malloc_pool_display (malloc_pool_image ());
+
+ fclose (finput);
}
static void
+2001-11-18 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * lang.c (finish_parse): Rename to java_finish.
+ (LANG_HOOKS_FINISH, java_finish): New.
+
2001-11-15 Neil Booth <neil@daikokuya.demon.co.uk>
* decl.c (init_decl_processing): Rename java_init_decl_processing.
};
static const char *java_init PARAMS ((const char *));
+static void java_finish PARAMS ((void));
static void java_init_options PARAMS ((void));
static int java_decode_option PARAMS ((int, char **));
static void put_decl_string PARAMS ((const char *, int));
#define LANG_HOOKS_NAME "GNU Java"
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT java_init
+#undef LANG_HOOKS_FINISH
+#define LANG_HOOKS_FINISH java_finish
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS java_init_options
#undef LANG_HOOKS_DECODE_OPTION
return filename;
}
-void
-finish_parse ()
+static void
+java_finish ()
{
jcf_dependency_write ();
}
/* Called after options parsing, to initialize the front end. The
main input filename is passed, which may be NULL; the front end
- should return the original filename (e.g. foo.i -> foo.c). */
+ should return the original filename (e.g. foo.i -> foo.c).
+ Return NULL to indicate a serious error of some sort; in that
+ case no compilation is performed, and the finish hook is called
+ immediately. */
const char * (*init) PARAMS ((const char *));
/* Called last, as a finalizer. */
#define LANG_HOOKS_NAME "GNU Objective-C"
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT objc_init
+#undef LANG_HOOKS_FINISH
+#define LANG_HOOKS_FINISH c_common_finish
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS objc_init_options
#undef LANG_HOOKS_DECODE_OPTION
static void parse_options_and_default_flags PARAMS ((int, char **));
static void process_options PARAMS ((void));
static void lang_independent_init PARAMS ((void));
-static void lang_dependent_init PARAMS ((const char *));
+static int lang_dependent_init PARAMS ((const char *));
static void init_asm_output PARAMS ((const char *));
+static void finalize PARAMS ((void));
static void set_target_switch PARAMS ((const char *));
static const char *decl_name PARAMS ((tree, int));
timevar_pop (TV_PARSE);
if (flag_syntax_only)
- goto finish_syntax;
+ return;
globals = getdecls ();
IDENT_ASM_OP, version_string);
#endif
- /* Language-specific end of compilation actions. */
- finish_syntax:
- (*lang_hooks.finish) ();
-
- /* Close the dump files. */
-
- if (flag_gen_aux_info)
- {
- fclose (aux_info_file);
- if (errorcount)
- unlink (aux_info_file_name);
- }
-
if (optimize > 0 && open_dump_file (DFI_combine, NULL))
{
timevar_push (TV_DUMP);
close_dump_file (DFI_combine, NULL, NULL_RTX);
timevar_pop (TV_DUMP);
}
-
- /* Close non-debugging input and output files. Take special care to note
- whether fclose returns an error, since the pages might still be on the
- buffer chain while the file is open. */
-
- finish_parse ();
-
- if (ferror (asm_out_file) != 0)
- fatal_io_error ("error writing to %s", asm_file_name);
- if (fclose (asm_out_file) != 0)
- fatal_io_error ("error closing %s", asm_file_name);
-
- /* Do whatever is necessary to finish printing the graphs. */
- if (graph_dump_format != no_graph)
- {
- int i;
-
- for (i = 0; i < (int) DFI_MAX; ++i)
- if (dump_file[i].initialized && dump_file[i].graph_dump_p)
- {
- char seq[16];
- char *suffix;
-
- sprintf (seq, ".%02d.", i);
- suffix = concat (seq, dump_file[i].extension, NULL);
- finish_graph_dump_file (dump_base_name, suffix);
- free (suffix);
- }
- }
-
- if (mem_report)
- {
- ggc_print_statistics ();
- stringpool_statistics ();
- dump_tree_statistics ();
- }
-
- /* Free up memory for the benefit of leak detectors. */
- free_reg_info ();
}
\f
/* This is called from various places for FUNCTION_DECL, VAR_DECL,
expand_dummy_function_end ();
}
\f
-/* Language-dependent initialization. */
-static void
+/* Language-dependent initialization. Returns non-zero on success. */
+static int
lang_dependent_init (name)
const char *name;
{
not done yet. This routine must return the original filename
(e.g. foo.i -> foo.c) so can correctly initialize debug output. */
name = (*lang_hooks.init) (name);
+ if (name == NULL)
+ return 0;
- if (name)
- name = ggc_strdup (name);
-
+ /* Is this duplication necessary? */
+ name = ggc_strdup (name);
main_input_filename = input_filename = name;
init_asm_output (name);
(*debug_hooks->init) (name);
timevar_pop (TV_SYMOUT);
+
+ return 1;
+}
+\f
+/* Clean up: close opened files, etc. */
+
+static void
+finalize ()
+{
+ /* Close the dump files. */
+ if (flag_gen_aux_info)
+ {
+ fclose (aux_info_file);
+ if (errorcount)
+ unlink (aux_info_file_name);
+ }
+
+ /* Close non-debugging input and output files. Take special care to note
+ whether fclose returns an error, since the pages might still be on the
+ buffer chain while the file is open. */
+
+ if (asm_out_file)
+ {
+ if (ferror (asm_out_file) != 0)
+ fatal_io_error ("error writing to %s", asm_file_name);
+ if (fclose (asm_out_file) != 0)
+ fatal_io_error ("error closing %s", asm_file_name);
+ }
+
+ /* Do whatever is necessary to finish printing the graphs. */
+ if (graph_dump_format != no_graph)
+ {
+ int i;
+
+ for (i = 0; i < (int) DFI_MAX; ++i)
+ if (dump_file[i].initialized && dump_file[i].graph_dump_p)
+ {
+ char seq[16];
+ char *suffix;
+
+ sprintf (seq, ".%02d.", i);
+ suffix = concat (seq, dump_file[i].extension, NULL);
+ finish_graph_dump_file (dump_base_name, suffix);
+ free (suffix);
+ }
+ }
+
+ if (mem_report)
+ {
+ ggc_print_statistics ();
+ stringpool_statistics ();
+ dump_tree_statistics ();
+ }
+
+ /* Free up memory for the benefit of leak detectors. */
+ free_reg_info ();
+
+ /* Language-specific end of compilation actions. */
+ (*lang_hooks.finish) ();
}
\f
/* Entry point of cc1, cc1plus, jc1, f771, etc.
if (exit_after_options)
return (SUCCESS_EXIT_CODE);
- /* Start timing total execution time. */
-
/* The bulk of command line switch processing. */
process_options ();
hashes etc. */
lang_independent_init ();
- /* Language-dependent initialization. */
- lang_dependent_init (filename);
+ /* Language-dependent initialization. Returns true on success. */
+ if (lang_dependent_init (filename))
+ compile_file ();
- compile_file ();
+ finalize ();
/* Stop timing and print the times. */
timevar_stop (TV_TOTAL);
extern void (*incomplete_decl_finalize_hook) PARAMS ((tree));
-extern void finish_parse PARAMS ((void));
-
/* Declare a predefined function. Return the declaration. This function is
provided by each language frontend. */
extern tree builtin_function PARAMS ((const char *, tree, int,