This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
a language-specific options hook
- To: egcs-patches at cygnus dot com
- Subject: a language-specific options hook
- From: Richard Henderson <rth at cygnus dot com>
- Date: Thu, 4 Jun 1998 00:20:50 -0700
- Reply-To: Richard Henderson <rth at cygnus dot com>
I was reminded today about a piece of uglyness I'd been intending
to clean up for some time. The fact that I no longer have to add
-fset-g77-defaults to the f771 gdb command line is merely coincidental.
r~
Thu Jun 4 00:12:32 1998 Richard Henderson <rth@cygnus.com>
* toplev.c (flag_exceptions): Default to 0.
(compile_file): Remove flag_exceptions == 2 hack.
(main): Call lang_init_options.
* tree.h: Declare it.
* c-lang.c: Implement it.
cp/
* lex.c (lang_init_options): New function.
(lang_init): Remove flag_exceptions == 2 hack.
f/
* com.c (lang_init_options): New function.
* top.c (ffe_decode_option): Remove all trace of -fset-g77-defaults.
* lang-options.h: Likewise.
* lang-specs.h: Likewise.
objc/
* objc-act.c (lang_init_options): New function.
Index: toplev.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/toplev.c,v
retrieving revision 1.68
diff -c -p -d -r1.68 toplev.c
*** toplev.c 1998/05/20 00:24:26 1.68
--- toplev.c 1998/06/04 07:12:06
*************** int flag_pic;
*** 598,604 ****
/* Nonzero means generate extra code for exception handling and enable
exception handling. */
! int flag_exceptions = 2;
/* Nonzero means don't place uninitialized global data in common storage
by default. */
--- 598,604 ----
/* Nonzero means generate extra code for exception handling and enable
exception handling. */
! int flag_exceptions;
/* Nonzero means don't place uninitialized global data in common storage
by default. */
*************** compile_file (name)
*** 2416,2447 ****
input_file_stack->next = 0;
input_file_stack->name = input_filename;
- /* Gross. Gross. lang_init is (I think) the first callback into
- the language front end, and is thus the first opportunity to
- have the selected language override the default value for any
- -f option.
-
- So the default value for flag_exceptions is 2 (uninitialized).
- If we encounter -fno-exceptions or -fexceptions, then flag_exceptions
- will be set to zero or one respectively.
-
- flag_exceptions can also be set by lang_init to something other
- than the default "uninitialized" value of 2.
-
- After lang_init, if the value is still 2, then we default to
- -fno-exceptions (value will be reset to zero).
-
- When our EH mechanism is low enough overhead that we can enable
- it by default for languages other than C++, then all this braindamage
- will go away. */
-
/* Perform language-specific initialization.
This may set main_input_filename. */
lang_init ();
- if (flag_exceptions == 2)
- flag_exceptions = 0;
-
/* If the input doesn't start with a #line, use the input name
as the official input file name. */
if (main_input_filename == 0)
--- 2416,2425 ----
*************** main (argc, argv, envp)
*** 3774,3779 ****
--- 3752,3760 ----
/* Initialize how much space enums occupy, by default. */
flag_short_enums = DEFAULT_SHORT_ENUMS;
#endif
+
+ /* Perform language-specific options intialization. */
+ lang_init_options ();
/* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */
Index: tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/tree.h,v
retrieving revision 1.34
diff -c -p -d -r1.34 tree.h
*** tree.h 1998/05/22 20:58:14 1.34
--- tree.h 1998/06/04 07:12:06
*************** extern void dwarf2out_end_epilogue PROTO
*** 1941,1946 ****
--- 1941,1949 ----
/* The language front-end must define these functions. */
+ /* Function of no arguments for initializing options. */
+ extern void lang_init_options PROTO((void));
+
/* Function of no arguments for initializing lexical scanning. */
extern void init_lex PROTO((void));
/* Function of no arguments for initializing the symbol table. */
Index: c-lang.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/c-lang.c,v
retrieving revision 1.10
diff -c -p -d -r1.10 c-lang.c
*** c-lang.c 1998/05/13 12:39:52 1.10
--- c-lang.c 1998/06/04 07:12:06
*************** lang_decode_option (p)
*** 38,43 ****
--- 38,48 ----
}
void
+ lang_init_options ()
+ {
+ }
+
+ void
lang_init ()
{
#if !USE_CPPLIB
Index: cp/lex.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/lex.c,v
retrieving revision 1.49
diff -c -p -d -r1.49 lex.c
*** lex.c 1998/05/28 01:44:29 1.49
--- lex.c 1998/06/04 07:12:07
*************** char *cplus_tree_code_name[] = {
*** 396,401 ****
--- 396,408 ----
/* toplev.c needs to call these. */
void
+ lang_init_options ()
+ {
+ /* Default exceptions on. */
+ flag_exceptions = 1;
+ }
+
+ void
lang_init ()
{
/* the beginning of the file is a new line; check for # */
*************** lang_init ()
*** 404,413 ****
put_back (check_newline ());
if (flag_gnu_xref) GNU_xref_begin (input_filename);
init_repo (input_filename);
-
- /* See comments in toplev.c before the call to lang_init. */
- if (flag_exceptions == 2)
- flag_exceptions = 1;
}
void
--- 411,416 ----
Index: f/com.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/f/com.c,v
retrieving revision 1.32
diff -c -p -d -r1.32 com.c
*** com.c 1998/06/03 14:12:26 1.32
--- com.c 1998/06/04 07:12:08
*************** lang_identify ()
*** 14935,14940 ****
--- 14935,14949 ----
}
void
+ lang_init_options ()
+ {
+ /* Set default options for Fortran. */
+ flag_move_all_movables = 1;
+ flag_reduce_all_givs = 1;
+ flag_argument_noalias = 2;
+ }
+
+ void
lang_init ()
{
/* If the file is output from cpp, it should contain a first line
Index: f/lang-options.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/f/lang-options.h,v
retrieving revision 1.5
diff -c -p -d -r1.5 lang-options.h
*** lang-options.h 1998/05/19 10:49:49 1.5
--- lang-options.h 1998/06/04 07:12:08
*************** the Free Software Foundation, 59 Temple
*** 29,35 ****
"-fversion",
"-fnull-version",
- "-fset-g77-defaults",
/*"-fident",*/
/*"-fno-ident",*/
"-ff66",
--- 29,34 ----
Index: f/lang-specs.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/f/lang-specs.h,v
retrieving revision 1.4
diff -c -p -d -r1.4 lang-specs.h
*** lang-specs.h 1998/05/19 10:49:50 1.4
--- lang-specs.h 1998/06/04 07:12:08
*************** the Free Software Foundation, 59 Temple
*** 52,58 ****
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} -traditional\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
! "%{!M:%{!MM:%{!E:f771 %{!pipe:%g.i} -fset-g77-defaults %(f771) \
%{!Q:-quiet} -dumpbase %b.F %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*} \
%{v:-version -fversion} %{pg:-p} %{p} %{f*} %{I*}\
--- 52,58 ----
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} -traditional\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
! "%{!M:%{!MM:%{!E:f771 %{!pipe:%g.i} %(f771) \
%{!Q:-quiet} -dumpbase %b.F %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*} \
%{v:-version -fversion} %{pg:-p} %{p} %{f*} %{I*}\
*************** the Free Software Foundation, 59 Temple
*** 67,73 ****
{"ratfor %{C} %{v}\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{!E:%{!pipe:-o %g.f}}%{E:%W{o*}} %i |\n",
! "%{!E:f771 %{!pipe:%g.f} -fset-g77-defaults %(f771) \
%{!Q:-quiet} -dumpbase %b.r %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*} \
%{v:-version -fversion} %{pg:-p} %{p} %{f*} %{I*}\
--- 67,73 ----
{"ratfor %{C} %{v}\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{!E:%{!pipe:-o %g.f}}%{E:%W{o*}} %i |\n",
! "%{!E:f771 %{!pipe:%g.f} %(f771) \
%{!Q:-quiet} -dumpbase %b.r %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*} \
%{v:-version -fversion} %{pg:-p} %{p} %{f*} %{I*}\
*************** the Free Software Foundation, 59 Temple
*** 80,86 ****
{".f", {"@f77"}},
{".for", {"@f77"}},
{"@f77",
! {"%{!M:%{!MM:%{!E:f771 %i -fset-g77-defaults %(f771) \
%{!Q:-quiet} -dumpbase %b.f %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*}\
%{v:-version -fversion} %{pg:-p} %{p} %{f*} %{I*}\
--- 80,86 ----
{".f", {"@f77"}},
{".for", {"@f77"}},
{"@f77",
! {"%{!M:%{!MM:%{!E:f771 %i %(f771) \
%{!Q:-quiet} -dumpbase %b.f %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*}\
%{v:-version -fversion} %{pg:-p} %{p} %{f*} %{I*}\
Index: f/top.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/f/top.c,v
retrieving revision 1.4
diff -c -p -d -r1.4 top.c
*** top.c 1998/05/19 10:50:49 1.4
--- top.c 1998/06/04 07:12:08
*************** ffe_decode_option (char *opt)
*** 171,188 ****
else if (strcmp (&opt[2], "null-version") == 0)
; /* Someday generate program to print version
info. */
- else if (strcmp (&opt[2], "set-g77-defaults") == 0)
- {
- ffe_is_do_internal_checks_ = 0;
- #if BUILT_FOR_270 /* User must have applied patch (circa 2.7.2 and beyond). */
- #if 0
- flag_rerun_loop_opt = 1;
- #endif
- flag_move_all_movables = 1;
- flag_reduce_all_givs = 1;
- flag_argument_noalias = 2;
- #endif
- }
else if (strcmp (&opt[2], "ident") == 0)
ffe_set_is_ident (TRUE);
else if (strcmp (&opt[2], "no-ident") == 0)
--- 171,176 ----
Index: objc/objc-act.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/objc/objc-act.c,v
retrieving revision 1.9
diff -c -p -d -r1.9 objc-act.c
*** objc-act.c 1998/05/13 12:40:39 1.9
--- objc-act.c 1998/06/04 07:12:08
*************** generate_struct_by_value_array ()
*** 581,586 ****
--- 581,591 ----
}
void
+ lang_init_options ()
+ {
+ }
+
+ void
lang_init ()
{
#if !USE_CPPLIB