mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-12 21:33:54 +08:00
Makefile.in (c-parse.o, c-common.o): Update dependencies.
* 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
This commit is contained in:
parent
6ad8427bba
commit
22703ccc3f
@ -1,3 +1,22 @@
|
||||
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.
|
||||
|
@ -1,3 +1,10 @@
|
||||
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.
|
||||
|
@ -6,7 +6,7 @@
|
||||
* *
|
||||
* C Implementation File *
|
||||
* *
|
||||
* $Revision: 1.11 $
|
||||
* $Revision: 1.12 $
|
||||
* *
|
||||
* Copyright (C) 1992-2001 Free Software Foundation, Inc. *
|
||||
* *
|
||||
@ -192,7 +192,7 @@ yyparse ()
|
||||
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;
|
||||
@ -251,7 +251,7 @@ gnat_decode_option (argc, argv)
|
||||
|
||||
/* Initialize for option processing. */
|
||||
|
||||
void
|
||||
static void
|
||||
gnat_init_options ()
|
||||
{
|
||||
/* Initialize gnat_argv with save_argv size */
|
||||
@ -394,6 +394,9 @@ gnat_init (filename)
|
||||
dwarf2out_set_demangle_name_func (convert_ada_name_to_qualified_name);
|
||||
#endif
|
||||
|
||||
if (filename == 0)
|
||||
filename = "";
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
@ -879,11 +882,6 @@ insert_code_for (gnat_node)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
finish_parse ()
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* Return the alignment for GNAT_TYPE. */
|
||||
|
@ -30,6 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
#include "ggc.h"
|
||||
#include "expr.h"
|
||||
#include "c-common.h"
|
||||
#include "diagnostic.h"
|
||||
#include "tm_p.h"
|
||||
#include "obstack.h"
|
||||
#include "c-lex.h"
|
||||
@ -3889,6 +3890,17 @@ c_common_lang_init (filename)
|
||||
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 ()
|
||||
{
|
||||
|
@ -543,6 +543,7 @@ extern void disable_builtin_function PARAMS ((const char *));
|
||||
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));
|
||||
|
@ -54,6 +54,8 @@ static int c_cannot_inline_tree_fn 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
|
||||
|
@ -50,7 +50,6 @@ end ifc
|
||||
#include "output.h"
|
||||
#include "toplev.h"
|
||||
#include "ggc.h"
|
||||
#include "diagnostic.h"
|
||||
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
#include <locale.h>
|
||||
@ -3530,14 +3529,6 @@ init_reswords ()
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
11
gcc/cp/lex.c
11
gcc/cp/lex.c
@ -265,7 +265,8 @@ void
|
||||
cxx_finish ()
|
||||
{
|
||||
if (flag_gnu_xref)
|
||||
GNU_xref_end (errorcount+sorrycount);
|
||||
GNU_xref_end (errorcount + sorrycount);
|
||||
c_common_finish ();
|
||||
}
|
||||
|
||||
static int *
|
||||
@ -740,14 +741,6 @@ cxx_init (filename)
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
void
|
||||
finish_parse ()
|
||||
{
|
||||
cpp_finish (parse_in);
|
||||
/* Call to cpp_destroy () omitted for performance reasons. */
|
||||
errorcount += cpp_errors (parse_in);
|
||||
}
|
||||
|
||||
inline void
|
||||
yyprint (file, yychar, yylval)
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -14189,12 +14189,6 @@ ffecom_init_decl_processing ()
|
||||
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. */
|
||||
@ -14303,6 +14297,8 @@ ffe_finish ()
|
||||
|
||||
if (ffe_is_ffedebug ())
|
||||
malloc_pool_display (malloc_pool_image ());
|
||||
|
||||
fclose (finput);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
@ -49,6 +49,7 @@ struct string_option
|
||||
};
|
||||
|
||||
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));
|
||||
@ -199,6 +200,8 @@ static int dependency_tracking = 0;
|
||||
#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
|
||||
@ -508,8 +511,8 @@ java_init (filename)
|
||||
return filename;
|
||||
}
|
||||
|
||||
void
|
||||
finish_parse ()
|
||||
static void
|
||||
java_finish ()
|
||||
{
|
||||
jcf_dependency_write ();
|
||||
}
|
||||
|
@ -61,7 +61,10 @@ struct lang_hooks
|
||||
|
||||
/* 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. */
|
||||
|
@ -456,6 +456,8 @@ static int print_struct_values = 0;
|
||||
#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
|
||||
|
136
gcc/toplev.c
136
gcc/toplev.c
@ -165,8 +165,9 @@ static void general_init PARAMS ((char *));
|
||||
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));
|
||||
@ -2168,7 +2169,7 @@ compile_file ()
|
||||
timevar_pop (TV_PARSE);
|
||||
|
||||
if (flag_syntax_only)
|
||||
goto finish_syntax;
|
||||
return;
|
||||
|
||||
globals = getdecls ();
|
||||
|
||||
@ -2250,19 +2251,6 @@ compile_file ()
|
||||
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);
|
||||
@ -2270,45 +2258,6 @@ compile_file ()
|
||||
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 ();
|
||||
}
|
||||
|
||||
/* This is called from various places for FUNCTION_DECL, VAR_DECL,
|
||||
@ -5112,8 +5061,8 @@ lang_independent_init ()
|
||||
expand_dummy_function_end ();
|
||||
}
|
||||
|
||||
/* Language-dependent initialization. */
|
||||
static void
|
||||
/* Language-dependent initialization. Returns non-zero on success. */
|
||||
static int
|
||||
lang_dependent_init (name)
|
||||
const char *name;
|
||||
{
|
||||
@ -5125,10 +5074,11 @@ lang_dependent_init (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);
|
||||
|
||||
@ -5154,6 +5104,65 @@ lang_dependent_init (name)
|
||||
(*debug_hooks->init) (name);
|
||||
|
||||
timevar_pop (TV_SYMOUT);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 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) ();
|
||||
}
|
||||
|
||||
/* Entry point of cc1, cc1plus, jc1, f771, etc.
|
||||
@ -5179,8 +5188,6 @@ toplev_main (argc, argv)
|
||||
if (exit_after_options)
|
||||
return (SUCCESS_EXIT_CODE);
|
||||
|
||||
/* Start timing total execution time. */
|
||||
|
||||
/* The bulk of command line switch processing. */
|
||||
process_options ();
|
||||
|
||||
@ -5193,10 +5200,11 @@ toplev_main (argc, argv)
|
||||
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);
|
||||
|
@ -2647,8 +2647,6 @@ extern const char *(*decl_printable_name) PARAMS ((tree, int));
|
||||
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user