aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-06-14 12:26:36 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-06-14 12:26:36 +0000
commitd7b426187568d50a4ed8a14d319970f8d2c34eb2 (patch)
treec305de4bdbbe6e6f7807a99ebcbbb965f0549ad6
parent81d2d258f5b5578131c9add593df10bd4758f219 (diff)
Makefile.in: Update to use common.opt and lang_opt_files.
* 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. From-SVN: r67941
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/Makefile.in23
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/Make-lang.in12
-rw-r--r--gcc/ada/misc.c6
-rw-r--r--gcc/c-opts.c2
-rw-r--r--gcc/common.opt47
-rwxr-xr-xgcc/configure8
-rw-r--r--gcc/configure.in5
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/Make-lang.in3
-rw-r--r--gcc/f/ChangeLog9
-rw-r--r--gcc/f/Make-lang.in11
-rw-r--r--gcc/f/com.c15
-rw-r--r--gcc/f/top.c19
-rw-r--r--gcc/f/top.h1
-rw-r--r--gcc/java/ChangeLog7
-rw-r--r--gcc/java/Make-lang.in11
-rw-r--r--gcc/java/lang.c6
-rw-r--r--gcc/opts.c55
-rw-r--r--gcc/opts.h14
-rw-r--r--gcc/opts.sh52
-rw-r--r--gcc/toplev.c27
-rw-r--r--gcc/treelang/ChangeLog9
-rw-r--r--gcc/treelang/Make-lang.in13
-rw-r--r--gcc/treelang/tree1.c11
-rw-r--r--gcc/treelang/treetree.c2
-rw-r--r--gcc/treelang/treetree.h1
28 files changed, 277 insertions, 123 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1ce8b1e6612..d824921d399 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,23 @@
+2003-06-14 Neil Booth <neil@daikokuya.co.uk>
+
+ * 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.
+
2003-06-14 Nick Clifton <nickc@redhat.com>
* doc/install.texi (Specific): Add description of different
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index bd841229106..e96eb38d8ec 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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 builtins.o caller-save.o calls.o \
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-pretty-print.h pretty-print.h \
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) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_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.mostlyclean
-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-*
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 1d2abfe1be0..a0bdb474d8b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,12 @@
2003-06-14 Neil Booth <neil@daikokuya.co.uk>
+ * 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.
+
+2003-06-14 Neil Booth <neil@daikokuya.co.uk>
+
* lang.opt: Add -Wall.
* misc.c (gnat_handle_option): Handle it.
diff --git a/gcc/ada/Make-lang.in b/gcc/ada/Make-lang.in
index 33c019cf88f..a2ca68475ea 100644
--- a/gcc/ada/Make-lang.in
+++ b/gcc/ada/Make-lang.in
@@ -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) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
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 \
@@ -2525,10 +2523,4 @@ ada/widechar.o : ada/ada.ads ada/a-except.ads ada/hostparm.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
diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c
index eaab916d9a4..4d171fc1a6f 100644
--- a/gcc/ada/misc.c
+++ b/gcc/ada/misc.c
@@ -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 char *arg, int value ATTRIBUTE_UNUSED)
switch (code)
{
default:
- return 0;
+ abort();
case OPT_I:
q = xmalloc (sizeof("-I") + strlen (arg));
@@ -294,7 +294,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. */
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 20884867df4..f1c87cb41b6 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -36,7 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#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
diff --git a/gcc/common.opt b/gcc/common.opt
new file mode 100644
index 00000000000..c3c955e2462
--- /dev/null
+++ b/gcc/common.opt
@@ -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.
diff --git a/gcc/configure b/gcc/configure
index cae6648e1e4..b4ac3e0b738 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -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/configure.frag $srcdir "$subdirs" "$dep_host_xma
+
# 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
diff --git a/gcc/configure.in b/gcc/configure.in
index 44e10effdad..a3fe7ec270a 100644
--- a/gcc/configure.in
+++ b/gcc/configure.in
@@ -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)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9c3069d2a81..8713ac966b3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-14 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in: Remove c-options.o.
+
2003-06-13 Nathanael Nerode <neroden@gcc.gnu.org>
* lex.c: Convert to ISO C.
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 7f823dc391e..ddada02bd6b 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -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 \
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index 76717e667af..e6667f4695e 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,12 @@
+Sat Jun 14 13:25:00 2003 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in: Update to use options.c and options.h.
+ * top.c: Include options.h not f-options.h.
+ (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.
+
2003-06-13 Richard Henderson <rth@redhat.com>
PR debug/9864
diff --git a/gcc/f/Make-lang.in b/gcc/f/Make-lang.in
index 0fe264bd26b..c243317e7ae 100644
--- a/gcc/f/Make-lang.in
+++ b/gcc/f/Make-lang.in
@@ -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) $(SYSTEM_H) f/top.h f/malloc.h f/where.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
diff --git a/gcc/f/com.c b/gcc/f/com.c
index 4de5d6c18ae..6750fc32f20 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -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(())
@@ -14265,20 +14264,6 @@ ffe_finish ()
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
ffe_mark_addressable (tree exp)
{
diff --git a/gcc/f/top.c b/gcc/f/top.c
index 715e61ceebb..7ca2db998b8 100644
--- a/gcc/f/top.c
+++ b/gcc/f/top.c
@@ -47,7 +47,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#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 char *arg, int value)
switch (code)
{
default:
- return 0;
+ abort();
case OPT_fversion:
ffe_set_is_version (TRUE);
diff --git a/gcc/f/top.h b/gcc/f/top.h
index 60c099512c4..041dc16ef62 100644
--- a/gcc/f/top.h
+++ b/gcc/f/top.h
@@ -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);
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index fcd451d5362..88bc7fe44dd 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,10 @@
+2003-06-14 Neil Booth <neil@daikokuya.co.uk>
+
+ * 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.
+
2003-06-11 Neil Booth <neil@daikokuya.co.uk>
* Make-lang.in: Handle mostlyclean.
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index 7bac1872649..ae2a7e73165 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -108,7 +108,7 @@ gt-java-builtins.h gtype-java.h gt-java-resource.h : s-gtype ; @true
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 $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
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) \
@@ -348,12 +347,6 @@ java/xref.o: java/xref.c java/xref.h $(CONFIG_H) $(JAVA_TREE_H) toplev.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) \
$(JAVA_TREE_H)
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index cb907a7956f..8fd4ba07437 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -46,7 +46,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#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 char *arg, int value)
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
diff --git a/gcc/opts.c b/gcc/opts.c
index 83561b2679f..99b3298688b 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -26,8 +26,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#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, char **argv, int lang_mask)
{
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, char **argv, int lang_mask)
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, char **argv, int lang_mask)
if (*arg == '\0')
arg = NULL;
}
- }
- temp = (*lang_hooks.handle_option) (opt_index, arg, on);
- if (temp <= 0)
- result = temp;
+ 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;
+}
diff --git a/gcc/opts.h b/gcc/opts.h
index 0bba52d3499..340092e87d3 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -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_count;
#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
diff --git a/gcc/opts.sh b/gcc/opts.sh
index 1ce8c4a089d..9be2c5d7bef 100644
--- a/gcc/opts.sh
+++ b/gcc/opts.sh
@@ -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
- }
- {
- 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
- }
+ 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++;
+ }
+
+ 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
}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 85157e7bb0d..f349f73f5f1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -359,7 +359,6 @@ static void close_dump_file (enum dump_file_index,
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. */
@@ -4594,14 +4593,7 @@ 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;
- }
+ return 1;
arg++;
@@ -4705,13 +4697,6 @@ independent_decode_option (int argc, char **argv)
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 +5370,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 +5381,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 +5723,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 ();
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog
index 933d8fb95af..710f468de2a 100644
--- a/gcc/treelang/ChangeLog
+++ b/gcc/treelang/ChangeLog
@@ -1,3 +1,12 @@
+2003-06-14 Neil Booth <neil@daikokuya.co.uk>
+
+ * 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.
+
2003-06-12 Andreas Jaeger <aj@suse.de>
* treetree.c: Remove cl_options-count and cl_options.
diff --git a/gcc/treelang/Make-lang.in b/gcc/treelang/Make-lang.in
index d5e96af4bcd..52106a43291 100644
--- a/gcc/treelang/Make-lang.in
+++ b/gcc/treelang/Make-lang.in
@@ -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 treelang/treetree.o treelang/lex.o treelang/par
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 $(CONFIG_H) $(SYSTEM_H) coretypes.h \
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
diff --git a/gcc/treelang/tree1.c b/gcc/treelang/tree1.c
index f4e5fa84cb5..6be21a34095 100644
--- a/gcc/treelang/tree1.c
+++ b/gcc/treelang/tree1.c
@@ -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, const char *arg ATTRIBUTE_UNUSED,
switch (code)
{
default:
- return 0;
+ abort();
case OPT__help:
if (!version_done)
diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c
index d6720cb8433..40db1908517 100644
--- a/gcc/treelang/treetree.c
+++ b/gcc/treelang/treetree.c
@@ -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;
diff --git a/gcc/treelang/treetree.h b/gcc/treelang/treetree.h
index c87b3af4da6..2c7aec3b5f3 100644
--- a/gcc/treelang/treetree.h
+++ b/gcc/treelang/treetree.h
@@ -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);