Commit 3c900cb5 by Neil Booth Committed by Neil Booth

Make-lang.in: Update to handle command-line options.

ada:
	* Make-lang.in: Update to handle command-line options.
	* lang.opt: New file.
	* misc.c: Include aoptions.h.
	(cl_options_count, cl_options): Remove.
	(gnat_handle_option): New.
	(gnat_decode_option): Remove.
	(LANG_HOOKS_DECODE_OPTION): Remove.
	(LANG_HOOKS_HANDLE_OPTION): Override.

From-SVN: r67795
parent 7e53cfb2
2003-06-11 Neil Booth <neil@daikokuya.co.uk>
* Make-lang.in: Update to handle command-line options.
* lang.opt: New file.
* misc.c: Include aoptions.h.
(cl_options_count, cl_options): Remove.
(gnat_handle_option): New.
(gnat_decode_option): Remove.
(LANG_HOOKS_DECODE_OPTION): Remove.
(LANG_HOOKS_HANDLE_OPTION): Override.
2003-06-10 Nathanael Nerode <neroden@gcc.gnu.org>
* init.c, misc.c, trans.c, utils.c: Remove dead code.
......
......@@ -116,7 +116,8 @@ 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/trans.o ada/cuintp.o ada/argv.o ada/raise.o ada/init.o ada/tracebak.o \
ada/aoptions.o
# Object files from Ada sources that are used by gnat1
......@@ -760,6 +761,7 @@ 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:
......@@ -1014,7 +1016,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/fe.h $(ADA_TREE_H) ada/gigi.h ada/adadecode.h opts.h ada/aoptions.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 \
......@@ -2523,4 +2525,10 @@ 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
; Options for the Java front end.
; 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 "Ada". 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.
I
Ada Joined Separate
fRTS
Ada RejectNegative
gant
Ada Joined
gnat
Ada Joined
; This comment is to ensure we retain the blank line above.
......@@ -75,17 +75,16 @@
#include "gigi.h"
#include "adadecode.h"
#include "opts.h"
#include "aoptions.h"
extern FILE *asm_out_file;
extern int save_argc;
extern char **save_argv;
const unsigned int cl_options_count;
const struct cl_option cl_options[1];
static size_t gnat_tree_size PARAMS ((enum tree_code));
static bool gnat_init PARAMS ((void));
static int gnat_init_options PARAMS ((void));
static int gnat_decode_option PARAMS ((int, char **));
static int gnat_handle_option (size_t scode, const char *arg, int value);
static HOST_WIDE_INT gnat_get_alias_set PARAMS ((tree));
static void gnat_print_decl PARAMS ((FILE *, tree, int));
static void gnat_print_type PARAMS ((FILE *, tree, int));
......@@ -108,8 +107,8 @@ static rtx gnat_expand_expr PARAMS ((tree, rtx, enum machine_mode,
#define LANG_HOOKS_INIT gnat_init
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS gnat_init_options
#undef LANG_HOOKS_DECODE_OPTION
#define LANG_HOOKS_DECODE_OPTION gnat_decode_option
#undef LANG_HOOKS_HANDLE_OPTION
#define LANG_HOOKS_HANDLE_OPTION gnat_handle_option
#undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE gnat_parse_file
#undef LANG_HOOKS_HONOR_READONLY
......@@ -219,58 +218,50 @@ gnat_parse_file (set_yydebug)
from ARGV that it successfully decoded; 0 indicates failure. */
static int
gnat_decode_option (argc, argv)
int argc ATTRIBUTE_UNUSED;
char **argv;
gnat_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
{
char *p = argv[0];
const struct cl_option *option = &cl_options[scode];
enum opt_code code = (enum opt_code) scode;
char *q;
int i;
if (!strncmp (p, "-I", 2))
/* Ignore file names. */
if (code == N_OPTS)
return 1;
if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
{
/* We might get -I foo or -Ifoo. Canonicalize to the latter. */
if (p[2] == '\0')
{
char *q;
if (argv[1] == 0)
return 0;
q = xmalloc (sizeof("-I") + strlen (argv[1]));
strcpy (q, "-I");
strcat (q, argv[1]);
gnat_argv[gnat_argc] = q;
gnat_argc ++;
return 2; /* consumed argument */
}
else
{
gnat_argv[gnat_argc] = p;
gnat_argc ++;
return 1;
}
error ("missing argument to \"-%s\"", option->opt_text);
return 1;
}
else if (!strncmp (p, "-gant", 5))
switch (code)
{
char *q = xstrdup (p);
case OPT_I:
q = xmalloc (sizeof("-I") + strlen (arg));
strcpy (q, "-I");
strcat (q, arg);
gnat_argv[gnat_argc] = q;
gnat_argc++;
break;
case OPT_fRTS:
gnat_argv[gnat_argc] = "-fRTS";
gnat_argc++;
break;
case OPT_gant:
warning ("`-gnat' misspelled as `-gant'");
q[2] = 'n', q[3] = 'a';
p = q;
return 1;
}
break;
else if (!strncmp (p, "-gnat", 5))
{
case OPT_gnat:
/* Recopy the switches without the 'gnat' prefix */
gnat_argv[gnat_argc] = (char *) xmalloc (strlen (p) - 3);
gnat_argv[gnat_argc] = xmalloc (strlen (arg) + 2);
gnat_argv[gnat_argc][0] = '-';
strcpy (gnat_argv[gnat_argc] + 1, p + 5);
gnat_argc ++;
if (p[5] == 'O')
strcpy (gnat_argv[gnat_argc] + 1, arg);
gnat_argc++;
if (arg[0] == 'O')
for (i = 1; i < save_argc - 1; i++)
if (!strncmp (save_argv[i], "-gnatO", 6))
if (save_argv[++i][0] != '-')
......@@ -280,25 +271,10 @@ gnat_decode_option (argc, argv)
gnat_argc++;
break;
}
return 1;
}
/* Handle the --RTS switch. The real option we get is -fRTS. This
modification is done by the driver program. */
if (!strncmp (p, "-fRTS", 5))
{
gnat_argv[gnat_argc] = p;
gnat_argc ++;
return 1;
break;
}
/* Ignore -W flags since people may want to use the same flags for all
languages. */
else if (p[0] == '-' && p[1] == 'W' && p[2] != 0)
return 1;
return 0;
return 1;
}
/* Initialize for option processing. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment