Start moving toplev options to opts.c

Neil Booth neil@daikokuya.co.uk
Fri Jun 13 23:00:00 GMT 2003


This patch only moves -quiet, but touches 22 files 8-)  The old toplev.c
switches appear in a new file common.opt.

After this it should be fairly easy and mechanical to move the rest.

With this, all front ends contain the union of the options handled by
all front ends, which appear in options.c and options.h.  It is hard
to keep true separation, though it could be done.  It's not worth the
effort since the extra data is < 5K, having the union has advantages
in the future such as better diagnostics about wrong switches, and
keeping them separate would obfuscate Makefiles etc.

Bootstrapping and regtesting all bar Ada on x86 NetBSD.

Neil.

	* Makefile.in: Update to use common.opt and lang_opt_files.
	(c-options.c, c-options.h): Remove.
	(options.c, options.h): Add.
	* c-opts.c: Include options.h not c-options.h.
	* common.opt: New file.
	* configure, configure.in: Add lang_opt_files.
	* opts.c: Include flags.h and diagnostic.h.
	(common_handle_option): New.
	(handle_option): Update to recognize common options and all
	language-dependent options.
	* opts.h (CL_F77, CL_JAVA, CL_ADA, CL_COMMON, CL_TREELANG): New.
	(struct cl_option): Make flags of type int.
	* opts.h: Flag option with front ends to which it applies.
	Handle duplicate options.
	* toplev.c (filename): Remove.
	(independent_decode_option): Don't handle filenames and -quiet.
	(process_options, do_compile): Update.
ada:
	* Make-lang.in: Update to use options.c and options.h.
	* misc.c: Include options.h not aoptions.h.
	(gnat_handle_option): Abort on unrecognized switch.
	(gnat_init_options): Request Ada switches.
cp:
	* Make-lang.in: Remove c-options.o.
f:
	* Make-lang.in: Update to use options.c and options.h.
	* top.c: Include options.h not f-options.h.
	(gnat_handle_option): Abort on unrecognized switch.
	(ffe_init_options): From com.c.  Request F77 options.
	(ffe_handle_options): Abort on unrecognized switch.
	* com.c (ffe_init_options): Move to top.c.
	* top.h (fee_init_options): New.
java:
	* Make-lang.in: Update to use options.c and options.h.
	* lang.c: Include options.h not j-options.h.
	(java_handle_option): Abort on unrecognized option.
	(java_init_options): Request Java switches.
treelang:
	* Make-lang.in: Update to use options.c and options.h.
	* tree1.c: Include options.h not t-options.h.
	(treelang_init_options): New.
	(treelang_handle_option): Abort on unrecognized switch.
	* treetree.c (LANG_HOOKS_INIT_OPTIONS): Override.
	* treetree.h (treelang_init_options): New.

============================================================
Index: gcc/Makefile.in
--- gcc/Makefile.in	10 Jun 2003 00:52:11 -0000	1.1077
+++ gcc/Makefile.in	13 Jun 2003 22:36:32 -0000
@@ -353,6 +353,7 @@ host_xm_file=@host_xm_file@
 host_xm_defines=@host_xm_defines@
 xm_file=@xm_file@
 xm_defines=@xm_defines@
+lang_opt_files=@lang_opt_files@ $(srcdir)/c.opt $(srcdir)/common.opt
 lang_specs_files=@lang_specs_files@
 lang_options_files=@lang_options_files@
 lang_tree_files=@lang_tree_files@
@@ -793,7 +794,7 @@ CXX_TARGET_OBJS=@cxx_target_objs@
 # Language-specific object files for C and Objective C.
 C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \
   c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \
-  c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o c-options.o prefix.o \
+  c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
   c-objc-common.o c-dump.o c-pch.o libcpp.a $(C_TARGET_OBJS)
 
 # Language-specific object files for C.
@@ -812,7 +813,7 @@ OBJS = alias.o bb-reorder.o bitmap.o bui
  haifa-sched.o hashtable.o hooks.o ifcvt.o insn-attrtab.o insn-emit.o	   \
  insn-extract.o insn-opinit.o insn-output.o insn-peep.o insn-recog.o	   \
  integrate.o intl.o jump.o  langhooks.o lcm.o lists.o local-alloc.o  	   \
- loop.o mbchar.o optabs.o opts.o params.o predict.o			   \
+ loop.o mbchar.o optabs.o options.o opts.o params.o predict.o		   \
  print-rtl.o print-tree.o						   \
  profile.o ra.o ra-build.o ra-colorize.o ra-debug.o ra-rewrite.o	   \
  real.o recog.o reg-stack.o regclass.o regmove.o regrename.o		   \
@@ -1317,16 +1318,10 @@ c-pretty-print.o : c-pretty-print.c c-pr
 
 c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
         c-pragma.h flags.h toplev.h langhooks.h tree-inline.h diagnostic.h \
-	intl.h debug.h $(C_COMMON_H) opts.h c-options.h
+	intl.h debug.h $(C_COMMON_H) opts.h options.h
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 		$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
 
-c-options.c: c.opt $(srcdir)/opts.sh c-options.h
-
-c-options.h: c.opt $(srcdir)/opts.sh
-	AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh c-options.c c-options.h \
-		$(srcdir)/c.opt
-
 c-cppbuiltin.o : c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	$(TREE_H) $(C_COMMON_H) c-pragma.h flags.h toplev.h langhooks.h \
 	output.h except.h real.h $(TM_P_H)
@@ -1421,6 +1416,12 @@ s-specs : Makefile
 	$(SHELL) $(srcdir)/move-if-change tmp-specs.h specs.h
 	$(STAMP) s-specs
 
+options.c: $(lang_opt_files) $(srcdir)/opts.sh options.h
+
+options.h: $(lang_opt_files) $(srcdir)/opts.sh
+	AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh options.c options.h \
+		$(lang_opt_files)
+
 dumpvers: dumpvers.c
 
 version.o: version.c version.h
@@ -1480,7 +1481,7 @@ fold-const.o : fold-const.c $(CONFIG_H) 
 diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \
    $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \
    input.h toplev.h intl.h langhooks.h $(LANGHOOKS_DEF_H)
-opts.o : opts.c opts.h $(CONFIG_H) $(SYSTEM_H) \
+opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \
 	coretypes.h $(TREE_H) $(TM_H) $(LANGHOOKS_H)
 toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
    function.h flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h diagnostic.h \
@@ -2788,7 +2789,7 @@ mostlyclean: $(INTL_MOSTLYCLEAN) lang.mo
 	-rm -f xlimits.h
 # Delete other built files.
 	-rm -f xsys-protos.hT
-	-rm -f specs.h options_.h gencheck.h c-options.c c-options.h
+	-rm -f specs.h options_.h gencheck.h options.c options.h
 # Delete the stamp and temporary files.
 	-rm -f s-* tmp-* stamp-* stmp-*
 	-rm -f */stamp-* */tmp-*
============================================================
Index: gcc/c-opts.c
--- gcc/c-opts.c	12 Jun 2003 14:02:41 -0000	1.56
+++ gcc/c-opts.c	13 Jun 2003 22:36:32 -0000
@@ -36,7 +36,7 @@ Software Foundation, 59 Temple Place - S
 #include "c-incpath.h"
 #include "debug.h"		/* For debug_hooks.  */
 #include "opts.h"
-#include "c-options.h"
+#include "options.h"
 
 #ifndef DOLLARS_IN_IDENTIFIERS
 # define DOLLARS_IN_IDENTIFIERS true
============================================================
Index: gcc/common.opt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/common.opt	13 Jun 2003 22:36:32 -0000
@@ -0,0 +1,47 @@
+; Options for the language- and target-independent parts of the compiler.
+; Copyright (C) 2003 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 2, or (at your option) any later
+; version.
+; 
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+; 
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING.  If not, write to the Free
+; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+; 02111-1307, USA.
+
+
+; This file is processed by the script opts.sh.  It is a database of
+; command line options, with each record separated by a blank line,
+; and each field appearing on its own line.  The first field is the
+; command-line switch with the leading "-" removed.  All options
+; beginning with "f" or "W" are implicitly assumed to take a "no-"
+; form; this form should not be listed.  If you do not want this
+; negative form and you want it to be automatically rejected, add
+; RejectNegative to the second field.
+
+; The second field should contain "Common".  If the switch takes an
+; argument, then you should also specify "Joined" and/or "Separate" to
+; indicate where the argument can appear.
+
+; Comments can appear on their own line anwhere in the file, preceded
+; by a semicolon.  Whitespace is permitted before the semicolon.
+
+; For each switch XXX below, an enumeration constant is created by the
+; script opts.sh spelt OPT_XXX, but with all non-alphanumeric
+; characters replaced with an underscore.
+
+; Please try to keep this file in ASCII collating order.
+
+quiet
+Common
+
+; This comment is to ensure we retain the blank line above.
============================================================
Index: gcc/configure
--- gcc/configure	12 Jun 2003 07:09:56 -0000	1.701
+++ gcc/configure	13 Jun 2003 22:36:34 -0000
@@ -2440,7 +2440,7 @@ fi
 
 
 # Find some useful tools
-for ac_prog in gawk mawk nawk awk
+for ac_prog in mawk gawk nawk awk
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -8799,11 +8799,15 @@ fi
 # Make empty files to contain the specs and options for each language.
 # Then add #include lines to for a compiler that has specs and/or options.
 
+lang_opt_files=
 lang_specs_files=
 lang_options_files=
 lang_tree_files=
 for subdir in . $subdirs
 do
+	if test -f $srcdir/$subdir/lang.opt; then
+	    lang_opt_files="$lang_opt_files $srcdir/$subdir/lang.opt"
+	fi
 	if test -f $srcdir/$subdir/lang-specs.h; then
 	    lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
 	fi
@@ -9080,6 +9084,7 @@ ${CONFIG_SHELL-/bin/sh} $srcdir/configur
 
 
 
+
 # Echo that links are built
 if test x$host = x$target
 then
@@ -9387,6 +9392,7 @@ s%@host_xm_file@%$host_xm_file%g
 s%@host_xm_defines@%$host_xm_defines%g
 s%@out_host_hook_obj@%$out_host_hook_obj%g
 s%@install@%$install%g
+s%@lang_opt_files@%$lang_opt_files%g
 s%@lang_options_files@%$lang_options_files%g
 s%@lang_specs_files@%$lang_specs_files%g
 s%@lang_tree_files@%$lang_tree_files%g
============================================================
Index: gcc/configure.in
--- gcc/configure.in	12 Jun 2003 07:09:55 -0000	1.685
+++ gcc/configure.in	13 Jun 2003 22:36:35 -0000
@@ -2893,11 +2893,15 @@ AC_SUBST(MAINT)dnl
 # Make empty files to contain the specs and options for each language.
 # Then add #include lines to for a compiler that has specs and/or options.
 
+lang_opt_files=
 lang_specs_files=
 lang_options_files=
 lang_tree_files=
 for subdir in . $subdirs
 do
+	if test -f $srcdir/$subdir/lang.opt; then
+	    lang_opt_files="$lang_opt_files $srcdir/$subdir/lang.opt"
+	fi
 	if test -f $srcdir/$subdir/lang-specs.h; then
 	    lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
 	fi
@@ -3141,6 +3145,7 @@ AC_SUBST(host_xm_file)
 AC_SUBST(host_xm_defines)
 AC_SUBST(out_host_hook_obj)
 AC_SUBST(install)
+AC_SUBST(lang_opt_files)
 AC_SUBST(lang_options_files)
 AC_SUBST(lang_specs_files)
 AC_SUBST(lang_tree_files)
============================================================
Index: gcc/opts.c
--- gcc/opts.c	12 Jun 2003 19:01:08 -0000	1.4
+++ gcc/opts.c	13 Jun 2003 22:36:35 -0000
@@ -26,8 +26,12 @@ Software Foundation, 59 Temple Place - S
 #include "tree.h"
 #include "langhooks.h"
 #include "opts.h"
+#include "options.h"
+#include "flags.h"
+#include "toplev.h"
 
 static size_t find_opt (const char *, int);
+static int common_handle_option (size_t scode, const char *arg, int value);
 
 /* Perform a binary search to find which option the command-line INPUT
    matches.  Returns its index in the option array, and N_OPTS on
@@ -134,7 +138,8 @@ handle_option (int argc ATTRIBUTE_UNUSED
     {
       opt_index = cl_options_count;
       arg = opt;
-      result = 1;
+      main_input_filename = opt;
+      result = (*lang_hooks.handle_option) (opt_index, arg, on);
     }
   else
     {
@@ -152,8 +157,7 @@ handle_option (int argc ATTRIBUTE_UNUSED
 	  on = false;
 	}
 
-      /* Skip over '-'.  */
-      opt_index = find_opt (opt + 1, lang_mask);
+      opt_index = find_opt (opt + 1, lang_mask | CL_COMMON);
       if (opt_index == cl_options_count)
 	goto done;
 
@@ -191,14 +195,51 @@ handle_option (int argc ATTRIBUTE_UNUSED
 	  if (*arg == '\0')
 	    arg = NULL;
 	}
-    }
 
+      if (option->flags & lang_mask)
+	{
   temp = (*lang_hooks.handle_option) (opt_index, arg, on);
   if (temp <= 0)
     result = temp;
+	}
+
+      if (result > 0 && (option->flags & CL_COMMON))
+	{
+	  if (common_handle_option (opt_index, arg, on) == 0)
+	    result = 0;
+	}
+    }
 
  done:
   if (dup)
     free (dup);
   return result;
+}
+
+/* Handle target- and language-independent options.  Return zero to
+   generate an "unknown option" message.  */
+static int
+common_handle_option (size_t scode, const char *arg,
+		      int value ATTRIBUTE_UNUSED)
+{
+  const struct cl_option *option = &cl_options[scode];
+  enum opt_code code = (enum opt_code) scode;
+
+  if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
+    {
+      error ("missing argument to \"-%s\"", option->opt_text);
+      return 1;
+    }
+
+  switch (code)
+    {
+    default:
+      abort ();
+
+    case OPT_quiet:
+      quiet_flag = 1;
+      break;
+    }
+
+  return 1;
 }
============================================================
Index: gcc/opts.h
--- gcc/opts.h	8 Jun 2003 07:54:10 -0000	1.2
+++ gcc/opts.h	13 Jun 2003 22:36:35 -0000
@@ -27,7 +27,7 @@ struct cl_option
 {
   const char *opt_text;
   unsigned char opt_len;
-  unsigned char flags;
+  unsigned int flags;
 };
 
 extern const struct cl_option cl_options[];
@@ -37,8 +37,14 @@ extern const unsigned int cl_options_cou
 #define CL_OBJC			(1 << 1) /* Only ObjC.  */
 #define CL_CXX			(1 << 2) /* Only C++.  */
 #define CL_OBJCXX		(1 << 3) /* Only ObjC++.  */
-#define CL_JOINED		(1 << 4) /* If takes joined argument.  */
-#define CL_SEPARATE		(1 << 5) /* If takes a separate argument.  */
-#define CL_REJECT_NEGATIVE	(1 << 6) /* Reject no- form.  */
+#define CL_F77			(1 << 4) /* Only Fortran.  */
+#define CL_JAVA			(1 << 5) /* Only Java.  */
+#define CL_ADA			(1 << 6) /* Only Ada.  */
+#define CL_TREELANG		(1 << 7) /* Only Treelang.  */
+#define CL_COMMON		(1 << 8) /* Language-independent.  */
+
+#define CL_JOINED		(1 << 24) /* If takes joined argument.  */
+#define CL_SEPARATE		(1 << 25) /* If takes a separate argument.  */
+#define CL_REJECT_NEGATIVE	(1 << 26) /* Reject no- form.  */
 
 #endif
============================================================
Index: gcc/opts.sh
--- gcc/opts.sh	8 Jun 2003 07:54:10 -0000	1.6
+++ gcc/opts.sh	13 Jun 2003 22:36:35 -0000
@@ -48,6 +48,11 @@ cat "$@" | ${AWK} '
         if (langs ~ ":ObjC:") flags = flags " | CL_OBJC"
         if (langs ~ ":C\\+\\+:") flags = flags " | CL_CXX"
         if (langs ~ ":ObjC\\+\\+:") flags = flags " | CL_OBJCXX"
+        if (langs ~ ":F77:") flags = flags " | CL_F77"
+        if (langs ~ ":Java:") flags = flags " | CL_JAVA"
+        if (langs ~ ":Ada:") flags = flags " | CL_ADA"
+        if (langs ~ ":Tree:") flags = flags " | CL_TREELANG"
+        if (langs ~ ":Common:") flags = flags " | CL_COMMON"
         if (langs ~ ":Joined:") flags = flags " | CL_JOINED"
         if (langs ~ ":Separate:") flags = flags " | CL_SEPARATE"
         if (langs ~ ":RejectNegative:") flags = flags " | CL_REJECT_NEGATIVE"
@@ -56,29 +61,50 @@ cat "$@" | ${AWK} '
     }
 
     BEGIN {
+	FS = "\034"
+	n_opts = 0
+    }
+
+# Collect the text and flags of each option into an array
+    {
+	opts[n_opts] = $1
+	flags[n_opts] = $2
+	n_opts++;
+    }
+
+# Dump out an enumeration into a .h file, and an array of options into a
+# C file.  Combine the flags of duplicate options.
+    END {
 	c_file = "'${C_FILE}'"
 	h_file = "'${H_FILE}'"
-	FS = "\034"
+	comma = ","
+
 	print "/* This file is auto-generated by opts.sh.  */\n" > h_file
-	print "/* This file is auto-generated by opts.sh.  */\n" > c_file
 	print "enum opt_code\n{"			>> h_file
+
+	print "/* This file is auto-generated by opts.sh.  */\n" > c_file
 	print "#include \"" h_file "\""			>> c_file
 	print "#include \"opts.h\"\n"			>> c_file
 	print "const unsigned int cl_options_count = N_OPTS;\n" >> c_file
 	print "const struct cl_option cl_options[] =\n{" >> c_file
+
+	for (i = 0; i < n_opts; i++) {
+	    while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
+		flags[i + 1] = flags[i] " " flags[i + 1];
+		i++;
     }
 
-    {
-	opt = $1
-	gsub ( "[^A-Za-z0-9]", "_", opt)
-	s = substr ("                                  ", length (opt))
-	enum = "OPT_" opt
-	printf ("  %s,%s/* -%s */\n", enum, s, $1 )	>> h_file
-	printf ("  { \"%s\", %u, %s },\n", $1, \
-	    length ($1), switch_flags($2))		>> c_file
+	    enum = "OPT_" opts[i]
+	    gsub( "[^A-Za-z0-9]", "_", enum)
+	    s = substr("                                  ", length (opts[i]))
+	    if (i + 1 == n_opts)
+		comma = ""
+
+	    printf("  %s,%s/* -%s */\n", enum, s, opts[i]) >> h_file
+	    printf("  { \"%s\", %u, %s }%s\n", opts[i], \
+		length(opts[i]), switch_flags(flags[i]), comma) >> c_file
     }
 
-    END {
 	print "  N_OPTS\n};"				>> h_file
 	print "};"					>> c_file
     }
============================================================
Index: gcc/toplev.c
--- gcc/toplev.c	8 Jun 2003 19:35:53 -0000	1.769
+++ gcc/toplev.c	13 Jun 2003 22:36:37 -0000
@@ -359,7 +359,6 @@ static void close_dump_file (enum dump_f
 int rtl_dump_and_exit;
 int flag_print_asm_name;
 static int version_flag;
-static const char *filename;
 enum graph_dump_types graph_dump_format;
 
 /* Name for output file of assembly code, specified with -o.  */
@@ -4591,19 +4590,7 @@ ignoring option `%s' due to invalid debu
 static unsigned int
 independent_decode_option (int argc, char **argv)
 {
-  char *arg = argv[0];
-
-  if (arg[0] != '-' || arg[1] == 0)
-    {
-      if (arg[0] == '+')
-	return 0;
-
-      filename = arg;
-
-      return 1;
-    }
-
-  arg++;
+  char *arg = argv[0] + 1;
 
   if (!strcmp (arg, "-help"))
     {
@@ -4705,13 +4692,6 @@ independent_decode_option (int argc, cha
 	return 0;
       break;
 
-    case 'q':
-      if (!strcmp (arg, "quiet"))
-	quiet_flag = 1;
-      else
-	return 0;
-      break;
-
     case 'v':
       if (!strcmp (arg, "version"))
 	version_flag = 1;
@@ -5385,8 +5365,8 @@ process_options (void)
      initialization based on the command line options.  This hook also
      sets the original filename if appropriate (e.g. foo.i -> foo.c)
      so we can correctly initialize debug output.  */
-  no_backend = (*lang_hooks.post_options) (&filename);
-  main_input_filename = input_filename = filename;
+  no_backend = (*lang_hooks.post_options) (&main_input_filename);
+  input_filename = main_input_filename;
 
 #ifdef OVERRIDE_OPTIONS
   /* Some machines may reject certain combinations of options.  */
@@ -5396,9 +5376,9 @@ process_options (void)
   /* Set aux_base_name if not already set.  */
   if (aux_base_name)
     ;
-  else if (filename)
+  else if (main_input_filename)
     {
-      char *name = xstrdup (lbasename (filename));
+      char *name = xstrdup (lbasename (main_input_filename));
 
       strip_off_ending (name, strlen (name));
       aux_base_name = name;
@@ -5738,7 +5718,7 @@ do_compile (void)
 	backend_init ();
 
       /* Language-dependent initialization.  Returns true on success.  */
-      if (lang_dependent_init (filename))
+      if (lang_dependent_init (main_input_filename))
 	compile_file ();
 
       finalize ();
============================================================
Index: gcc/ada/Make-lang.in
--- gcc/ada/Make-lang.in	12 Jun 2003 05:42:08 -0000	1.34
+++ gcc/ada/Make-lang.in	13 Jun 2003 22:36:37 -0000
@@ -116,8 +116,7 @@ ADA_TOOLS_FLAGS_TO_PASS=\
 # Object files for gnat1 from C sources.
 GNAT1_C_OBJS = ada/b_gnat1.o ada/adadecode.o ada/adaint.o ada/cstreams.o \
  ada/cio.o ada/targtyps.o ada/decl.o ada/misc.o ada/utils.o ada/utils2.o \
- ada/trans.o ada/cuintp.o ada/argv.o ada/raise.o ada/init.o ada/tracebak.o \
- ada/aoptions.o
+ ada/trans.o ada/cuintp.o ada/argv.o ada/raise.o ada/init.o ada/tracebak.o
 
 # Object files from Ada sources that are used by gnat1
 
@@ -761,7 +760,6 @@ ada.mostlyclean:
 	-$(RM) ada/*$(objext) ada/*.ali ada/b_*.c
 	-$(RM) ada/*$(coverageexts)
 	-$(RM) ada/sdefault.adb ada/stamp-sdefault
-	-$(RM) ada/aoptions.c ada/aoptions.h
 	-$(RMDIR) ada/tools
 ada.clean:
 ada.distclean:
@@ -1016,7 +1014,7 @@ ada/misc.o : ada/misc.c $(CONFIG_H) $(SY
    diagnostic.h output.h except.h $(TM_P_H) langhooks.h debug.h $(LANGHOOKS_DEF_H) \
    libfuncs.h $(OPTABS_H) ada/ada.h ada/types.h ada/atree.h ada/nlists.h \
    ada/elists.h ada/sinfo.h ada/einfo.h ada/namet.h ada/stringt.h ada/uintp.h \
-   ada/fe.h $(ADA_TREE_H) ada/gigi.h ada/adadecode.h opts.h ada/aoptions.h
+   ada/fe.h $(ADA_TREE_H) ada/gigi.h ada/adadecode.h opts.h options.h
 
 ada/targtyps.o : ada/targtyps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    ada/ada.h ada/types.h ada/atree.h ada/nlists.h ada/elists.h ada/uintp.h \
@@ -2524,11 +2522,5 @@ ada/widechar.o : ada/ada.ads ada/a-excep
    ada/s-wchcnv.ads ada/s-wchcnv.adb ada/s-wchcon.ads ada/s-wchjis.ads \
    ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads \
    ada/widechar.adb 
-
-ada/aoptions.c: ada/lang.opt opts.sh ada/aoptions.h
-
-ada/aoptions.h: ada/lang.opt opts.sh
-	AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh ada/aoptions.c \
-		ada/aoptions.h $(srcdir)/ada/lang.opt
 
 # end of regular dependencies
============================================================
Index: gcc/ada/misc.c
--- gcc/ada/misc.c	12 Jun 2003 05:47:04 -0000	1.53
+++ gcc/ada/misc.c	13 Jun 2003 22:36:38 -0000
@@ -75,7 +75,7 @@
 #include "gigi.h"
 #include "adadecode.h"
 #include "opts.h"
-#include "aoptions.h"
+#include "options.h"
 
 extern FILE *asm_out_file;
 extern int save_argc;
@@ -238,7 +238,7 @@ gnat_handle_option (size_t scode, const 
   switch (code)
     {
     default:
-      return 0;
+      abort();
 
     case OPT_I:
       q = xmalloc (sizeof("-I") + strlen (arg));
@@ -290,7 +290,7 @@ gnat_init_options ()
   gnat_argv[0] = save_argv[0];     /* name of the command */ 
   gnat_argc = 1;
 
-  return 0;
+  return CL_ADA;
 }
 
 /* Here is the function to handle the compiler error processing in GCC.  */
============================================================
Index: gcc/cp/Make-lang.in
--- gcc/cp/Make-lang.in	11 Jun 2003 21:56:29 -0000	1.152
+++ gcc/cp/Make-lang.in	13 Jun 2003 22:36:38 -0000
@@ -80,8 +80,7 @@ g++-cross$(exeext): g++$(exeext)
 # Shared with C front end:
 CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
 	c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
-	c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
-	c-options.o
+	c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o
 
 # Language-specific object files.
 CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
============================================================
Index: gcc/f/Make-lang.in
--- gcc/f/Make-lang.in	8 Jun 2003 14:42:05 -0000	1.124
+++ gcc/f/Make-lang.in	13 Jun 2003 22:36:38 -0000
@@ -88,7 +88,7 @@ g77-cross$(exeext): g77$(exeext)
 
 F77_OBJS = f/bad.o f/bit.o f/bld.o f/com.o f/data.o f/equiv.o f/expr.o \
  f/global.o f/implic.o f/info.o f/intrin.o f/lab.o f/lex.o f/malloc.o \
- f/name.o f/f-options.o f/parse.o f/src.o f/st.o f/sta.o f/stb.o f/stc.o \
+ f/name.o f/parse.o f/src.o f/st.o f/sta.o f/stb.o f/stc.o \
  f/std.o f/ste.o f/storag.o f/stp.o f/str.o f/sts.o f/stt.o f/stu.o \
  f/stv.o f/stw.o f/symbol.o f/target.o f/top.o f/type.o f/where.o
 
@@ -320,7 +320,6 @@ f77.uninstall: installdirs
 f77.mostlyclean:
 	-rm -f f/*$(objext)
 	-rm -f f/*$(coverageexts)
-	-rm -f f/f-options.c f/f-options.h
 	-rm -f f/fini$(build_exeext) f/stamp-str f/str-*.h f/str-*.j
 	-rm -f f/intdoc$(build_exeext) f/ansify$(build_exeext) f/intdoc.h0
 	-rm -f g77.aux g77.cps g77.ky g77.toc g77.vr g77.fn g77.kys \
@@ -543,14 +542,8 @@ f/top.o: f/top.c f/proj.h $(CONFIG_H) $(
  f/info-w.def f/target.h f/lex.h f/type.h f/lab.h f/storag.h \
  f/symbol.h f/symbol.def f/equiv.h f/global.h f/name.h f/intrin.h \
  f/intrin.def f/data.h f/expr.h f/implic.h f/src.h f/st.h flags.h \
- toplev.h coretypes.h $(TM_H) opts.h f/f-options.h
+ toplev.h coretypes.h $(TM_H) opts.h options.h
 f/type.o: f/type.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/type.h f/malloc.h \
  coretypes.h $(TM_H)
 f/where.o: f/where.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/where.h glimits.h \
  f/top.h f/malloc.h f/lex.h $(GGC_H) gt-f-where.h coretypes.h $(TM_H)
-
-f/f-options.c: f/lang.opt opts.sh f/f-options.h
-
-f/f-options.h: f/lang.opt opts.sh
-	AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh f/f-options.c \
-		f/f-options.h $(srcdir)/f/lang.opt
============================================================
Index: gcc/f/com.c
--- gcc/f/com.c	8 Jun 2003 14:42:05 -0000	1.202
+++ gcc/f/com.c	13 Jun 2003 22:36:42 -0000
@@ -14125,7 +14125,6 @@ insert_block (tree block)
 static bool ffe_init PARAMS ((void));
 static void ffe_finish PARAMS ((void));
 static bool ffe_post_options PARAMS ((const char **));
-static int ffe_init_options PARAMS ((void));
 static void ffe_print_identifier PARAMS ((FILE *, tree, int));
 
 struct language_function GTY(())
@@ -14263,20 +14262,6 @@ ffe_finish ()
     malloc_pool_display (malloc_pool_image ());
 
   fclose (finput);
-}
-
-static int
-ffe_init_options ()
-{
-  /* Set default options for Fortran.  */
-  flag_move_all_movables = 1;
-  flag_reduce_all_givs = 1;
-  flag_argument_noalias = 2;
-  flag_merge_constants = 2;
-  flag_errno_math = 0;
-  flag_complex_divide_method = 1;
-
-  return 0;
 }
 
 static bool
============================================================
Index: gcc/f/top.c
--- gcc/f/top.c	8 Jun 2003 14:42:06 -0000	1.31
+++ gcc/f/top.c	13 Jun 2003 22:36:42 -0000
@@ -47,7 +47,7 @@ the Free Software Foundation, 59 Temple 
 #include "lex.h"
 #include "malloc.h"
 #include "name.h"
-#include "f-options.h"
+#include "options.h"
 #include "opts.h"
 #include "src.h"
 #include "st.h"
@@ -155,6 +155,21 @@ ffe_is_digit_string_ (const char *s)
   return (p != s) && (*p == '\0');
 }
 
+/* Get ready for options handling.  */
+int
+ffe_init_options ()
+{
+  /* Set default options for Fortran.  */
+  flag_move_all_movables = 1;
+  flag_reduce_all_givs = 1;
+  flag_argument_noalias = 2;
+  flag_merge_constants = 2;
+  flag_errno_math = 0;
+  flag_complex_divide_method = 1;
+
+  return CL_F77;
+}
+
 /* Handle command-line options.	 Returns 0 if unrecognized, 1 if
    recognized and handled.  */
 int
@@ -176,7 +191,7 @@ ffe_handle_option (size_t scode, const c
   switch (code)
     {
     default:
-      return 0;
+      abort();
 
     case OPT_fversion:
       ffe_set_is_version (TRUE);
============================================================
Index: gcc/f/top.h
--- gcc/f/top.h	8 Jun 2003 14:42:06 -0000	1.15
+++ gcc/f/top.h	13 Jun 2003 22:36:42 -0000
@@ -141,6 +141,7 @@ extern bool ffe_in_4;
 
 /* Declare functions with prototypes. */
 
+int ffe_init_options (void);
 int ffe_handle_option (size_t code, const char *arg, int on);
 void ffe_file (ffewhereFile wf, FILE *f);
 void ffe_init_0 (void);
============================================================
Index: gcc/java/Make-lang.in
--- gcc/java/Make-lang.in	11 Jun 2003 22:21:08 -0000	1.113
+++ gcc/java/Make-lang.in	13 Jun 2003 22:36:42 -0000
@@ -108,7 +108,7 @@ gt-java-builtins.h gtype-java.h gt-java-
 JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \
   java/constants.o java/lang.o java/typeck.o java/except.o java/verify.o \
   java/zextract.o java/jcf-io.o java/jcf-parse.o java/mangle.o \
-  java/mangle_name.o java/builtins.o java/resource.o java/j-options.o \
+  java/mangle_name.o java/builtins.o java/resource.o \
   java/jcf-write.o java/buffer.o java/check-init.o java/jcf-depend.o \
   java/jcf-path.o java/xref.o java/boehm.o java/java-tree-inline.o mkdeps.o
 
@@ -237,7 +237,6 @@ java.install-info: installdirs
 java.mostlyclean:
 	-rm -f java/*$(objext) $(DEMANGLER_PROG)
 	-rm -f java/*$(coverageexts)
-	-rm -f java/j-options.c java/j-options.h
 	-rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext) s-java
 java.clean:
 java.distclean:
@@ -327,7 +326,7 @@ java/jvgenmain.o: java/jvgenmain.c $(CON
   coretypes.h $(TM_H)
 java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
   toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(EXPR_H) diagnostic.h \
-  langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h java/j-options.h
+  langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h
 java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
   coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-mangle.h
 java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
@@ -347,12 +346,6 @@ java/xref.o: java/xref.c java/xref.h $(C
   $(SYSTEM_H) coretypes.h $(TM_H)
 java/zextract.o: java/zextract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   java/zipfile.h
-
-java/j-options.c: java/lang.opt opts.sh java/j-options.h
-
-java/j-options.h: java/lang.opt opts.sh
-	AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh java/j-options.c \
-		java/j-options.h $(srcdir)/java/lang.opt
 
 # jcf-io.o needs $(ZLIBINC) added to cflags.
 java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
============================================================
Index: gcc/java/lang.c
--- gcc/java/lang.c	11 Jun 2003 15:58:05 -0000	1.130
+++ gcc/java/lang.c	13 Jun 2003 22:36:42 -0000
@@ -46,7 +46,7 @@ The Free Software Foundation is independ
 #include "splay-tree.h"
 #include "tree-dump.h"
 #include "opts.h"
-#include "j-options.h"
+#include "options.h"
 
 static bool java_init (void);
 static void java_finish (void);
@@ -290,7 +290,7 @@ java_handle_option (size_t scode, const 
   switch (code)
     {
     default:
-      return 0;
+      abort();
 
     case OPT_I:
       jcf_path_include_arg (arg);
@@ -695,7 +695,7 @@ java_init_options (void)
 
   jcf_path_init ();
 
-  return 0;
+  return CL_JAVA;
 }
 
 static bool
============================================================
Index: gcc/treelang/Make-lang.in
--- gcc/treelang/Make-lang.in	11 Jun 2003 22:21:10 -0000	1.25
+++ gcc/treelang/Make-lang.in	13 Jun 2003 22:36:42 -0000
@@ -85,11 +85,11 @@ treelang.done: tree1$(exeext)
 # core compiler
 tree1$(exeext): treelang/tree1.o treelang/treetree.o treelang/lex.o treelang/parse.o\
 	$(TREE_BE_LIBS) c-convert.o c-typeck.o c-common.o c-cppbuiltin.o \
-	c-decl.o attribs.o treelang/t-options.o
+	c-decl.o attribs.o
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
 	treelang/tree1.o treelang/treetree.o treelang/lex.o treelang/parse.o \
 	c-convert.o c-typeck.o c-common.o c-cppbuiltin.o c-decl.o attribs.o \
-	$(TREE_BE_LIBS) treelang/t-options.o
+	$(TREE_BE_LIBS)
 
 #
 # Compiling object files from source files.
@@ -98,7 +98,7 @@ tree1$(exeext): treelang/tree1.o treelan
 
 treelang/tree1.o: treelang/tree1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   flags.h toplev.h $(GGC_H) $(TREE_H) diagnostic.h treelang/treelang.h \
-  input.h treelang/treetree.h treelang/t-options.h \
+  input.h treelang/treetree.h options.h opts.h \
   treelang/treetree.h gt-treelang-tree1.h gtype-treelang.h
 
 treelang/treetree.o: treelang/treetree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -112,12 +112,6 @@ treelang/parse.o: treelang/parse.c $(CON
 treelang/lex.o: treelang/lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(TM_H) diagnostic.h $(TREE_H) treelang/treelang.h input.h treelang/parse.h
 
-treelang/t-options.c: treelang/lang.opt opts.sh treelang/t-options.h
-
-treelang/t-options.h: treelang/lang.opt opts.sh
-	AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh treelang/t-options.c \
-		treelang/t-options.h $(srcdir)/treelang/lang.opt
-
 # generated files the files from lex and yacc are put into the source
 # directory in case someone wants to build but does not have
 # lex/yacc
@@ -237,7 +231,6 @@ treelang.mostlyclean:
 	    rm -f treelang/$$name$(exeext); \
 	  fi ; \
 	done
-	-rm -f treelang/t-options.c treelang/t-options.h
 	-rm -f treelang/*$(objext)
 	-rm -f treelang/*$(coverageexts)
 	-rm treelang.done
============================================================
Index: gcc/treelang/tree1.c
--- gcc/treelang/tree1.c	11 Jun 2003 22:21:10 -0000	1.9
+++ gcc/treelang/tree1.c	13 Jun 2003 22:36:42 -0000
@@ -45,7 +45,7 @@
 #include "treelang.h"
 #include "treetree.h"
 #include "opts.h"
-#include "t-options.h"
+#include "options.h"
 
 extern int yyparse (void);
 
@@ -88,6 +88,13 @@ static int version_done = 0;
 
 static unsigned int work_nesting_level = 0;
 
+/* Prepare to handle switches.  */
+int
+treelang_init_options (void)
+{
+  return CL_TREELANG;
+}
+
 /* Process a switch - called by opts.c.  */
 int
 treelang_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED,
@@ -98,7 +105,7 @@ treelang_handle_option (size_t scode, co
   switch (code)
     {
     default:
-      return 0;
+      abort();
 
     case OPT__help:
       if (!version_done)
============================================================
Index: gcc/treelang/treetree.c
--- gcc/treelang/treetree.c	12 Jun 2003 15:15:40 -0000	1.26
+++ gcc/treelang/treetree.c	13 Jun 2003 22:36:43 -0000
@@ -112,6 +112,8 @@ extern char **file_names;
 #define LANG_HOOKS_NAME	"GNU treelang"
 #undef LANG_HOOKS_FINISH
 #define LANG_HOOKS_FINISH		treelang_finish
+#undef LANG_HOOKS_INIT_OPTIONS
+#define LANG_HOOKS_INIT_OPTIONS  treelang_init_options
 #undef LANG_HOOKS_HANDLE_OPTION
 #define LANG_HOOKS_HANDLE_OPTION treelang_handle_option
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
============================================================
Index: gcc/treelang/treetree.h
--- gcc/treelang/treetree.h	11 Jun 2003 22:21:10 -0000	1.6
+++ gcc/treelang/treetree.h	13 Jun 2003 22:36:43 -0000
@@ -63,6 +63,7 @@ tree tree_code_get_type (int type_num);
 void treelang_init_decl_processing (void);
 void treelang_finish (void);
 bool treelang_init (void);
+int treelang_init_options (void);
 int treelang_handle_option (size_t scode, const char *arg, int value);
 void treelang_parse_file (int debug_flag);
 void push_var_level (void);



More information about the Gcc-patches mailing list