diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-11-09 07:14:20 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-11-09 07:14:20 +0000 |
commit | d19bd1f049e126f0e425e4f96a373db66ea623ea (patch) | |
tree | 591f114c0c680e4ec2d6ca91c6e753b8fbeaba3c /gcc | |
parent | 9b954fed46790dcab53b59729e847e7dede4d1d8 (diff) | |
download | gcc-d19bd1f049e126f0e425e4f96a373db66ea623ea.tar.gz |
* c-lang.c (LANG_HOOKS_NAME): New.
(lang_hooks): Constify.
(c_init_options): Update.
(lang_identify): Remove.
* c-parse.in (language_string): Remove.
* dbxout.c: Include langhooks.h.
(dbxout_symbol_location): Update.
* dwarf2out.c: Include langhooks.h.
(gen_compile_unit_die): Update.
* dwarfout.c: Include langhooks.h.
(prototyped_attribute, output_compile_unit_die): Update.
* langhooks-def.h (LANG_HOOKS_NAME, LANG_HOOKS_IDENTIFIER_SIZE): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hooks): New members. Constify.
* stringpool.c: Don't include toplev.h.
(set_identifier_size): Remove.
* toplev.c (toplev_main): Initialize identifier size.
(print_version): Update.
* tree.h (language_string, init_lex, lang_identify,
set_identifier_size): Remove.
* Makefile.in: Update dependencies.
* config/darwin.c: Include langhooks.h.
(func_name_maybe_scoped): Update.
* config/darwin.h (ASM_END_FILE): Update.
* config/nextstep.h (ASM_END_FILE): Update.
* config/nextstep21.h (ASM_END_FILE): Update.
* config/i386/sun386.h (ASM_END_FILE): Update.
* config/rs6000/rs6000.c (ASM_END_FILE): Include langhooks.h.
(rs6000_output_function_epilogue): Update.
ada:
* misc.c (LANG_HOOKS_NAME, LANG_HOOKS_IDENTIFIER_SIZE): Override.
(struct lang_hooks): Constify.
(language_string, lang_identify): Remove.
* utils.c (init_decl_processing): Update.
cp:
* cp-lang.c (LANG_HOOKS_NAME): Override.
(struct lang_hooks): Constify.
* lex.c (cxx_init_options): Update.
(lang_identify): Remove.
* parse.y (language_string): Remove.
f:
* com.c (language_string, lang_identify): Remove.
(struct lang_hooks): Constify.
(LANG_HOOKS_NAME): Override.
(init_parse): Update.
java:
* jcf-parse.c (init_lex): Remove.
* lang.c (language_string, lang_identify): Remove.
(struct lang_hooks): Constify.
(LANG_HOOKS_NAME): Override.
(init_parse): Update.
objc:
* objc-act.c (LANG_HOOKS_NAME): Override.
(struct lang_hooks): Constify.
(objc_init_options): Update.
(lang_identify): Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46874 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 37 | ||||
-rw-r--r-- | gcc/Makefile.in | 9 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/misc.c | 17 | ||||
-rw-r--r-- | gcc/ada/utils.c | 8 | ||||
-rw-r--r-- | gcc/c-lang.c | 13 | ||||
-rw-r--r-- | gcc/c-parse.in | 13 | ||||
-rw-r--r-- | gcc/config/darwin.c | 3 | ||||
-rw-r--r-- | gcc/config/darwin.h | 2 | ||||
-rw-r--r-- | gcc/config/i386/sun386.h | 2 | ||||
-rw-r--r-- | gcc/config/nextstep.h | 2 | ||||
-rw-r--r-- | gcc/config/nextstep21.h | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 4 | ||||
-rw-r--r-- | gcc/cp/lex.c | 9 | ||||
-rw-r--r-- | gcc/cp/parse.y | 4 | ||||
-rw-r--r-- | gcc/dbxout.c | 3 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 2 | ||||
-rw-r--r-- | gcc/dwarfout.c | 4 | ||||
-rw-r--r-- | gcc/f/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/f/com.c | 17 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/java/jcf-parse.c | 7 | ||||
-rw-r--r-- | gcc/java/lang.c | 14 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 4 | ||||
-rw-r--r-- | gcc/langhooks.h | 9 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 13 | ||||
-rw-r--r-- | gcc/stringpool.c | 14 | ||||
-rw-r--r-- | gcc/toplev.c | 6 | ||||
-rw-r--r-- | gcc/tree.h | 8 |
31 files changed, 126 insertions, 132 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 59f6cd6f117..a0731e541f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,40 @@ +2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk> + + * c-lang.c (LANG_HOOKS_NAME): New. + (lang_hooks): Constify. + (c_init_options): Update. + (lang_identify): Remove. + * c-parse.in (language_string): Remove. + * dbxout.c: Include langhooks.h. + (dbxout_symbol_location): Update. + * dwarf2out.c: Include langhooks.h. + (gen_compile_unit_die): Update. + * dwarfout.c: Include langhooks.h. + (prototyped_attribute, output_compile_unit_die): Update. + * langhooks-def.h (LANG_HOOKS_NAME, LANG_HOOKS_IDENTIFIER_SIZE): New. + (LANG_HOOKS_INITIALIZER): Update. + * langhooks.h (struct lang_hooks): New members. Constify. + * stringpool.c: Don't include toplev.h. + (set_identifier_size): Remove. + * toplev.c (toplev_main): Initialize identifier size. + (print_version): Update. + * tree.h (language_string, init_lex, lang_identify, + set_identifier_size): Remove. + * Makefile.in: Update dependencies. + * config/darwin.c: Include langhooks.h. + (func_name_maybe_scoped): Update. + * config/darwin.h (ASM_END_FILE): Update. + * config/nextstep.h (ASM_END_FILE): Update. + * config/nextstep21.h (ASM_END_FILE): Update. + * config/i386/sun386.h (ASM_END_FILE): Update. + * config/rs6000/rs6000.c (ASM_END_FILE): Include langhooks.h. + (rs6000_output_function_epilogue): Update. +objc: + * objc-act.c (LANG_HOOKS_NAME): Override. + (struct lang_hooks): Constify. + (objc_init_options): Update. + (lang_identify): Remove. + Fri Nov 9 00:25:18 EST 2001 John Wehle (john@feith.com) * fold-const.c (lshift_double): Honor PREC. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index b51fc436906..efc3ba8cbfe 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1422,7 +1422,7 @@ optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ insn-config.h $(EXPR_H) $(OPTABS_H) libfuncs.h $(RECOG_H) reload.h \ toplev.h $(GGC_H) real.h $(TM_P_H) except.h dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ - $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h \ + $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h langhooks.h \ insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h toplev.h debug.o : debug.c $(CONFIG_H) $(SYSTEM_H) sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ @@ -1431,11 +1431,11 @@ sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ sdbout.h toplev.h $(TM_P_H) except.h debug.h dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf.h \ flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \ - debug.h + debug.h langhooks.h dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf2.h \ debug.h flags.h insn-config.h reload.h output.h diagnostic.h \ hard-reg-set.h $(REGS_H) $(EXPR_H) libfuncs.h toplev.h dwarf2out.h varray.h \ - $(GGC_H) except.h dwarf2asm.h $(TM_P_H) + $(GGC_H) except.h dwarf2asm.h $(TM_P_H) langhooks.h dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) flags.h $(RTL_H) $(TREE_H) \ output.h dwarf2asm.h $(TM_P_H) xcoffout.o : xcoffout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) xcoffout.h \ @@ -1601,7 +1601,8 @@ params.o : params.c $(CONFIG_H) $(SYSTEM_H) $(PARAMS_H) toplev.h $(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) $(GGC_H) \ $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \ output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H) libfuncs.h \ - $(TARGET_DEF_H) function.h sched-int.h $(TM_P_H) $(EXPR_H) $(OPTABS_H) + $(TARGET_DEF_H) function.h sched-int.h $(TM_P_H) $(EXPR_H) $(OPTABS_H) \ + langhooks.h $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(out_file) $(OUTPUT_OPTION) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b7c2e6e71f1..07645b039f9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk> + + * misc.c (LANG_HOOKS_NAME, LANG_HOOKS_IDENTIFIER_SIZE): Override. + (struct lang_hooks): Constify. + (language_string, lang_identify): Remove. + * utils.c (init_decl_processing): Update. + 2001-11-06 Neil Booth <neil@cat.daikokuya.demon.co.uk> * misc.c: Include langhooks-def.h. diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 8ef1063c2fa..f6ad45b9f18 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * * * Copyright (C) 1992-2001 Free Software Foundation, Inc. * * * @@ -116,6 +116,10 @@ static HOST_WIDE_INT gnat_get_alias_set PARAMS ((tree)); /* Structure giving our language-specific hooks. */ +#undef LANG_HOOKS_NAME +#define LANG_HOOKS_NAME "GNU Ada" +#undef LANG_HOOKS_IDENTIFIER_SIZE +#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier) #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT gnat_init #undef LANG_HOOKS_INIT_OPTIONS @@ -127,7 +131,7 @@ static HOST_WIDE_INT gnat_get_alias_set PARAMS ((tree)); #undef LANG_HOOKS_GET_ALIAS_SET #define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set -struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; /* gnat standard argc argv */ @@ -136,7 +140,6 @@ extern char **gnat_argv; /* Global Variables Expected by gcc: */ -const char * const language_string = "GNU Ada"; int flag_traditional; /* Used by dwarfout.c. */ int ggc_p = 1; @@ -358,14 +361,6 @@ gnat_init () #endif } -/* Return a short string identifying this language to the debugger. */ - -const char * -lang_identify () -{ - return "ada"; -} - /* If DECL has a cleanup, build and return that cleanup here. This is a callback called by expand_expr. */ diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 42892e59727..a1900096e00 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * $Revision$ + * $Revision: 1.2 $ * * * Copyright (C) 1992-2001, Free Software Foundation, Inc. * * * @@ -480,12 +480,6 @@ pushdecl (decl) void init_decl_processing () { - /* The structure `tree_identifier' is the GCC tree data structure that holds - IDENTIFIER_NODE nodes. We need to call `set_identifier_size' to tell GCC - that we have not added any language specific fields to IDENTIFIER_NODE - nodes. */ - set_identifier_size (sizeof (struct tree_identifier)); - lineno = 0; /* incomplete_decl_finalize_hook is defined in toplev.c. It needs to be set diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 5f8f43ac094..b3d9094b8d4 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -49,6 +49,8 @@ static void c_post_options PARAMS ((void)); static int c_disregard_inline_limits PARAMS ((tree)); static int c_cannot_inline_tree_fn PARAMS ((tree *)); +#undef LANG_HOOKS_NAME +#define LANG_HOOKS_NAME "GNU C" #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT c_init #undef LANG_HOOKS_INIT_OPTIONS @@ -71,7 +73,7 @@ static int c_cannot_inline_tree_fn PARAMS ((tree *)); anon_aggr_type_p /* Each front end provides its own. */ -struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; /* Post-switch processing. */ static void @@ -99,9 +101,6 @@ c_post_options () static void c_init_options () { - /* Make identifier nodes long enough for the language-specific slots. */ - set_identifier_size (sizeof (struct lang_identifier)); - parse_in = cpp_create_reader (ident_hash, CLK_GNUC89); /* Mark as "unspecified". */ @@ -135,12 +134,6 @@ c_init () c_parse_init (); } -const char * -lang_identify () -{ - return "c"; -} - void print_lang_statistics () { diff --git a/gcc/c-parse.in b/gcc/c-parse.in index b3d9b2fb6cf..f458e03cb3a 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -60,15 +60,6 @@ ifobjc #include "objc-act.h" end ifobjc -/* Since parsers are distinct for each language, put the language string - definition here. */ -ifobjc -const char * const language_string = "GNU Objective-C"; -end ifobjc -ifc -const char * const language_string = "GNU C"; -end ifc - /* Like YYERROR but do call yyerror. */ #define YYERROR1 { yyerror ("syntax error"); YYERROR; } @@ -3542,10 +3533,6 @@ init_parse (filename) const char *filename; { add_c_tree_codes (); - - /* Make identifier nodes long enough for the language-specific slots. */ - set_identifier_size (sizeof (struct lang_identifier)); - init_reswords (); init_pragma (); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 158f375c4cb..caf81205588 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA. */ #include "reload.h" #include "function.h" #include "ggc.h" +#include "langhooks.h" #include "darwin-protos.h" @@ -565,7 +566,7 @@ func_name_maybe_scoped (fname) { if (is_cplusplus < 0) - is_cplusplus = (strcmp (lang_identify (), "cplusplus") == 0); + is_cplusplus = (strcmp (lang_hooks.name, "GNU C++") == 0); if (is_cplusplus) { diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index a7a96f31ff3..2b1826d43bd 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -175,7 +175,7 @@ do { text_section (); \ #define ASM_FILE_END(FILE) \ do { \ machopic_finish (asm_out_file); \ - if (strcmp (language_string, "GNU C++") == 0) \ + if (strcmp (lang_hooks.name, "GNU C++") == 0) \ { \ constructor_section (); \ destructor_section (); \ diff --git a/gcc/config/i386/sun386.h b/gcc/config/i386/sun386.h index 3f3ba3033f6..20d48c9340c 100644 --- a/gcc/config/i386/sun386.h +++ b/gcc/config/i386/sun386.h @@ -76,7 +76,7 @@ do \ fprintf (FILE, "\n"); \ } \ fprintf (FILE, "\t.version\t\"%s %s\"\n", \ - language_string, version_string); \ + lang_hooks.name, version_string); \ if (optimize) ASM_FILE_START_1 (FILE); \ } while (0) diff --git a/gcc/config/nextstep.h b/gcc/config/nextstep.h index 827584371e1..4be9e711cdb 100644 --- a/gcc/config/nextstep.h +++ b/gcc/config/nextstep.h @@ -229,7 +229,7 @@ extern void nextstep_asm_out_destructor PARAMS ((struct rtx_def *, int)); #undef ASM_FILE_END #define ASM_FILE_END(FILE) \ do { \ - if (strcmp (language_string, "GNU C++") == 0) \ + if (strcmp (lang_hooks.name, "GNU C++") == 0) \ { \ constructor_section (); \ destructor_section (); \ diff --git a/gcc/config/nextstep21.h b/gcc/config/nextstep21.h index 40004d1d0e6..7827054d897 100644 --- a/gcc/config/nextstep21.h +++ b/gcc/config/nextstep21.h @@ -43,7 +43,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_FILE_END #define ASM_FILE_END(FILE) \ do { \ - if (strcmp (language_string, "GNU C++") == 0) \ + if (strcmp (lang_hooks.name, "GNU C++") == 0) \ { \ ASM_OUTPUT_ALIGN (FILE, 1); \ } \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 0cf9b9c46aa..fc7ed613fa9 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -46,6 +46,7 @@ Boston, MA 02111-1307, USA. */ #include "tm_p.h" #include "target.h" #include "target-def.h" +#include "langhooks.h" #ifndef TARGET_NO_PROTOTYPE #define TARGET_NO_PROTOTYPE 0 @@ -7499,6 +7500,7 @@ rs6000_output_function_epilogue (file, size) if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive) { const char *fname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); + const char *language_string = lang_hooks.name; int fixed_parms, float_parms, parm_info; int i; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 688778dda7a..c2f51e6bb59 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk> + + * cp-lang.c (LANG_HOOKS_NAME): Override. + (struct lang_hooks): Constify. + * lex.c (cxx_init_options): Update. + (lang_identify): Remove. + * parse.y (language_string): Remove. + 2001-11-08 Andreas Franck <afranck@gmx.de> * Make-lang.in (CXX_INSTALL_NAME, GXX_CROSS_NAME, diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index fa3d766e635..cd951da0596 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -29,6 +29,8 @@ Boston, MA 02111-1307, USA. */ static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree)); +#undef LANG_HOOKS_NAME +#define LANG_HOOKS_NAME "GNU C++" #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT cxx_init #undef LANG_HOOKS_FINISH @@ -66,7 +68,7 @@ static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree)); #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p /* Each front end provides its own hooks, for toplev.c. */ -struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; /* Special routine to get the alias set for C++. */ diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index b655b0974fa..00765867ce1 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -248,9 +248,6 @@ cxx_post_options () void cxx_init_options () { - /* Make identifier nodes long enough for the language-specific slots. */ - set_identifier_size (sizeof (struct lang_identifier)); - parse_in = cpp_create_reader (ident_hash, CLK_GNUCXX); /* Default exceptions on. */ @@ -281,12 +278,6 @@ cxx_finish () GNU_xref_end (errorcount+sorrycount); } -const char * -lang_identify () -{ - return "cplusplus"; -} - static int * init_cpp_parse () { diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 937e1c8e817..1cf00209028 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -45,10 +45,6 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "ggc.h" -/* Since parsers are distinct for each language, put the language string - definition here. (fnf) */ -const char * const language_string = "GNU C++"; - extern struct obstack permanent_obstack; /* Like YYERROR but do call yyerror. */ diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 0a1ced61e05..50440f129cf 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -85,6 +85,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "debug.h" #include "function.h" #include "target.h" +#include "langhooks.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" @@ -2147,7 +2148,7 @@ dbxout_symbol_location (decl, type, suffix, home) we rely on the fact that error_mark_node initializers always end up in bss for C++ and never end up in bss for C. */ if (DECL_INITIAL (decl) == 0 - || (!strcmp (lang_identify (), "cplusplus") + || (!strcmp (lang_hooks.name, "GNU C++") && DECL_INITIAL (decl) == error_mark_node)) current_sym_code = N_LCSYM; else if (DECL_IN_TEXT_SECTION (decl)) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9ba26d3b648..a78eb8f5b10 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -59,6 +59,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "diagnostic.h" #include "debug.h" #include "target.h" +#include "langhooks.h" #include "hashtable.h" #ifdef DWARF2_DEBUGGING_INFO @@ -10470,6 +10471,7 @@ gen_compile_unit_die (filename) dw_die_ref die; char producer[250]; const char *wd = getpwd (); + const char *language_string = lang_hooks.name; int language; die = new_die (DW_TAG_compile_unit, NULL); diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index f5f2e3d6d6c..d52544e39a2 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -577,6 +577,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "toplev.h" #include "tm_p.h" #include "debug.h" +#include "langhooks.h" /* NOTE: In the comments in this file, many references are made to so called "Debugging Information Entries". For the sake of brevity, @@ -3462,7 +3463,7 @@ static inline void prototyped_attribute (func_type) tree func_type; { - if ((strcmp (language_string, "GNU C") == 0) + if ((strcmp (lang_hooks.name, "GNU C") == 0) && (TYPE_ARG_TYPES (func_type) != NULL)) { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_prototyped); @@ -4206,6 +4207,7 @@ output_compile_unit_die (arg) void *arg; { const char *main_input_filename = arg; + const char *language_string = lang_hooks.name; ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_compile_unit); sibling_attribute (); diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index b66e882e033..6daf9f0d77d 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,10 @@ +Fri Nov 9 07:14:47 2001 Neil Booth <neil@daikokuya.demon.co.uk> + + * com.c (language_string, lang_identify): Remove. + (struct lang_hooks): Constify. + (LANG_HOOKS_NAME): Override. + (init_parse): Update. + 2001-11-08 Andreas Franck <afranck@gmx.de> * Make-lang.in (G77_INSTALL_NAME, G77_CROSS_NAME): Handle diff --git a/gcc/f/com.c b/gcc/f/com.c index 428458b8c61..79eadefe0de 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -136,11 +136,6 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t; /* Externals defined here. */ -/* ~~gcc/tree.h *should* declare this, because toplev.c and dwarfout.c - reference it. */ - -const char * const language_string = "GNU F77"; - /* Stream for reading from the input file. */ FILE *finput; @@ -14212,8 +14207,6 @@ init_parse (filename) setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE); #endif - /* Make identifier nodes long enough for the language-specific slots. */ - set_identifier_size (sizeof (struct lang_identifier)); decl_printable_name = lang_printable_name; print_error_function = lang_print_error_function; @@ -14264,6 +14257,8 @@ static void ffe_init PARAMS ((void)); static void ffe_finish PARAMS ((void)); static void ffe_init_options PARAMS ((void)); +#undef LANG_HOOKS_NAME +#define LANG_HOOKS_NAME "GNU F77" #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT ffe_init #undef LANG_HOOKS_FINISH @@ -14281,7 +14276,7 @@ static void ffe_init_options PARAMS ((void)); #undef LANG_HOOKS_GET_ALIAS_SET #define LANG_HOOKS_GET_ALIAS_SET hook_get_alias_set_0 -struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; /* used by print-tree.c */ @@ -14302,12 +14297,6 @@ ffe_finish () malloc_pool_display (malloc_pool_image ()); } -const char * -lang_identify () -{ - return "f77"; -} - static void ffe_init_options () { diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index e2a115f51d7..284665932ed 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk> + + * jcf-parse.c (init_lex): Remove. + * lang.c (language_string, lang_identify): Remove. + (struct lang_hooks): Constify. + (LANG_HOOKS_NAME): Override. + (init_parse): Update. + 2001-11-08 Andreas Franck <afranck@gmx.de> * Make-lang.in (JAVA_INSTALL_NAME, JAVA_CROSS_NAME): Handle diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 75e0a23c582..6190cf358e5 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -262,13 +262,6 @@ parse_signature (jcf, sig_index) } void -init_lex () -{ - /* Make identifier nodes long enough for the language-specific slots. */ - set_identifier_size (sizeof (struct lang_identifier)); -} - -void set_yydebug (value) int value; { diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 91114b19e1f..feeb89ae0d7 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -99,8 +99,6 @@ static const char *const java_tree_code_name[] = { int compiling_from_source; -const char * const language_string = "GNU Java"; - char * resource_name; int flag_emit_class_files = 0; @@ -197,6 +195,8 @@ static int dependency_tracking = 0; #define DEPEND_TARGET_SET 4 #define DEPEND_FILE_ALREADY_SET 8 +#undef LANG_HOOKS_NAME +#define LANG_HOOKS_NAME "GNU Java" #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT java_init #undef LANG_HOOKS_INIT_OPTIONS @@ -205,7 +205,7 @@ static int dependency_tracking = 0; #define LANG_HOOKS_DECODE_OPTION java_decode_option /* Each front end provides its own. */ -struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; /* Process an option that can accept a `no-' form. Return 1 if option found, 0 otherwise. */ @@ -474,8 +474,6 @@ init_parse (filename) } } - init_lex (); - return filename; } @@ -744,12 +742,6 @@ java_init_options () flag_non_call_exceptions = 1; } -const char * -lang_identify () -{ - return "Java"; -} - /* Hooks for print_node. */ void diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 0e615cb5bca..340efddf680 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -56,6 +56,8 @@ tree lhd_tree_inlining_copy_res_decl_for_inlining PARAMS ((tree, tree, int *, void *)); int lhd_tree_inlining_anon_aggr_type_p PARAMS ((tree)); +#define LANG_HOOKS_NAME "GNU unknown" +#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier) #define LANG_HOOKS_INIT lhd_do_nothing #define LANG_HOOKS_FINISH lhd_do_nothing #define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack @@ -95,6 +97,8 @@ int lhd_tree_inlining_anon_aggr_type_p PARAMS ((tree)); /* The whole thing. The structure is defined in toplev.h. */ #define LANG_HOOKS_INITIALIZER { \ + LANG_HOOKS_NAME, \ + LANG_HOOKS_IDENTIFIER_SIZE, \ LANG_HOOKS_INIT, \ LANG_HOOKS_FINISH, \ LANG_HOOKS_CLEAR_BINDING_STACK, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 2f97b7ae491..5254afb1f99 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -49,6 +49,13 @@ struct lang_hooks_for_tree_inlining struct lang_hooks { + /* String identifying the front end. e.g. "GNU C++". */ + const char *name; + + /* sizeof (struct lang_identifier), so make_node () creates + identifier nodes long enough for the language-specific slots. */ + size_t identifier_size; + /* Called first, to initialize the front end. */ void (*init) PARAMS ((void)); @@ -88,6 +95,6 @@ struct lang_hooks }; /* Each front end provides its own. */ -extern struct lang_hooks lang_hooks; +extern const struct lang_hooks lang_hooks; #endif /* GCC_LANG_HOOKS_H */ diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 4e1c48de2a6..a4cbcdb273d 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -451,6 +451,8 @@ static int generating_instance_variables = 0; static int print_struct_values = 0; +#undef LANG_HOOKS_NAME +#define LANG_HOOKS_NAME "GNU Objective-C" #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT objc_init #undef LANG_HOOKS_INIT_OPTIONS @@ -461,7 +463,7 @@ static int print_struct_values = 0; #define LANG_HOOKS_POST_OPTIONS objc_post_options /* Each front end provides its own. */ -struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; /* Post-switch processing. */ static void @@ -536,9 +538,6 @@ generate_struct_by_value_array () static void objc_init_options () { - /* Make identifier nodes long enough for the language-specific slots. */ - set_identifier_size (sizeof (struct lang_identifier)); - parse_in = cpp_create_reader (ident_hash, CLK_OBJC); c_language = clk_objective_c; } @@ -601,12 +600,6 @@ finish_file () fclose (gen_declaration_file); } -const char * -lang_identify () -{ - return "objc"; -} - static int objc_decode_option (argc, argv) int argc; diff --git a/gcc/stringpool.c b/gcc/stringpool.c index bdee2c4ecac..e5b674a8903 100644 --- a/gcc/stringpool.c +++ b/gcc/stringpool.c @@ -32,7 +32,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ggc.h" #include "tree.h" #include "hashtable.h" -#include "toplev.h" /* The "" allocated string. */ const char empty_string[] = ""; @@ -143,19 +142,6 @@ maybe_get_identifier (text) return NULL_TREE; } -/* Record the size of an identifier node for the language in use. - SIZE is the total size in bytes. - This is called by the language-specific files. This must be - called before allocating any identifiers. */ - -void -set_identifier_size (size) - int size; -{ - tree_code_length[(int) IDENTIFIER_NODE] - = (size - sizeof (struct tree_common)) / sizeof (tree); -} - /* Report some basic statistics about the string pool. */ void diff --git a/gcc/toplev.c b/gcc/toplev.c index 2451aced5a6..f6473e11918 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4647,6 +4647,10 @@ toplev_main (argc, argv) flag_short_enums = DEFAULT_SHORT_ENUMS; #endif + tree_code_length[(int) IDENTIFIER_NODE] + = ((lang_hooks.identifier_size - sizeof (struct tree_common)) + / sizeof (tree)); + /* Initialize the garbage-collector. */ init_ggc (); init_stringpool (); @@ -5015,7 +5019,7 @@ print_version (file, indent) "%s%s%s version %s (%s) compiled by CC.\n" #endif , indent, *indent != 0 ? " " : "", - language_string, version_string, TARGET_NAME, + lang_hooks.name, version_string, TARGET_NAME, indent, __VERSION__); } diff --git a/gcc/tree.h b/gcc/tree.h index 93ca9af58bb..b92a5ecf3d9 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2650,8 +2650,6 @@ extern void (*incomplete_decl_finalize_hook) PARAMS ((tree)); extern const char *init_parse PARAMS ((const char *)); extern void finish_parse PARAMS ((void)); -extern const char * const language_string; - /* Declare a predefined function. Return the declaration. This function is provided by each language frontend. */ extern tree builtin_function PARAMS ((const char *, tree, int, @@ -2777,14 +2775,9 @@ extern tree fold_builtin PARAMS ((tree)); /* The language front-end must define these functions. */ -/* Function of no arguments for initializing lexical scanning. */ -extern void init_lex PARAMS ((void)); /* Function of no arguments for initializing the symbol table. */ extern void init_decl_processing PARAMS ((void)); -/* Function to identify which front-end produced the output file. */ -extern const char *lang_identify PARAMS ((void)); - /* Function to replace the DECL_LANG_SPECIFIC field of a DECL with a copy. */ extern void copy_lang_decl PARAMS ((tree)); @@ -2833,7 +2826,6 @@ struct obstack; /* In tree.c */ extern int really_constant_p PARAMS ((tree)); -extern void set_identifier_size PARAMS ((int)); extern int int_fits_type_p PARAMS ((tree, tree)); extern int tree_log2 PARAMS ((tree)); extern int tree_floor_log2 PARAMS ((tree)); |