Commit e938cdf5 authored by neil's avatar neil
Browse files

* hooks.c (hook_int_size_t_constcharptr_int_0): New.

	* hooks.h (hook_int_size_t_constcharptr_int_0): New.
	* langhooks-def.h (lhd_decode_option, LANG_HOOKS_DECODE_OPTION): Die.
	(LANG_HOOKS_HANDLE_OPTION, LANG_HOOKS_INITIALIZER): Update.
	* langhooks.c (lhd_decode_option): Remove.
	* langhooks.h (struct lang_hooks): Remove decode_option.
	* opts.c (handle_option): No longer use decode_option.
java:
	* Make-lang.in: Handle mostlyclean.
treelang:
	* Make-lang.in: Update for option handling.
	* lang.opt: New.
	* tree1.c: Include opts.h and t-options.h.
	(treelang_decode_option): Remove.
	(treelang_handle_option): New.
	* treetree.c (LANG_HOOKS_DECODE_OPTION): Remove.
	(LANG_HOOKS_HANDLE_OPTION): Override.
	* treetree.h (treelang_decode_option): Remove.
	(treelang_handle_option): New.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67799 138bc75d-0d04-0410-961f-82ee72b054a4
parent 266d04c5
2003-06-11 Neil Booth <neil@daikokuya.co.uk>
* hooks.c (hook_int_size_t_constcharptr_int_0): New.
* hooks.h (hook_int_size_t_constcharptr_int_0): New.
* langhooks-def.h (lhd_decode_option, LANG_HOOKS_DECODE_OPTION): Die.
(LANG_HOOKS_HANDLE_OPTION, LANG_HOOKS_INITIALIZER): Update.
* langhooks.c (lhd_decode_option): Remove.
* langhooks.h (struct lang_hooks): Remove decode_option.
* opts.c (handle_option): No longer use decode_option.
2003-06-11 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> 2003-06-11 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
   
* cfgloopanal.c (variable_initial_value): Update the set of altered * cfgloopanal.c (variable_initial_value): Update the set of altered
......
...@@ -110,6 +110,14 @@ hook_int_void_0 (void) ...@@ -110,6 +110,14 @@ hook_int_void_0 (void)
return 0; return 0;
} }
int
hook_int_size_t_constcharptr_int_0 (size_t a ATTRIBUTE_UNUSED,
const char *b ATTRIBUTE_UNUSED,
int c ATTRIBUTE_UNUSED)
{
return 0;
}
void void
hook_void_tree (a) hook_void_tree (a)
tree a ATTRIBUTE_UNUSED; tree a ATTRIBUTE_UNUSED;
......
...@@ -40,6 +40,7 @@ void hook_void_tree_treeptr PARAMS ((tree, tree *)); ...@@ -40,6 +40,7 @@ void hook_void_tree_treeptr PARAMS ((tree, tree *));
int hook_int_tree_tree_1 PARAMS ((tree, tree)); int hook_int_tree_tree_1 PARAMS ((tree, tree));
int hook_int_rtx_0 PARAMS ((rtx)); int hook_int_rtx_0 PARAMS ((rtx));
int hook_int_void_0 (void); int hook_int_void_0 (void);
int hook_int_size_t_constcharptr_int_0 (size_t, const char *, int);
bool default_can_output_mi_thunk_no_vcall bool default_can_output_mi_thunk_no_vcall
PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree)); PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
......
2003-06-11 Neil Booth <neil@daikokuya.co.uk>
* Make-lang.in: Handle mostlyclean.
2003-06-11 Tom Tromey <tromey@redhat.com> 2003-06-11 Tom Tromey <tromey@redhat.com>
   
* lang.c (java_handle_option): Update dependency_tracking for * lang.c (java_handle_option): Update dependency_tracking for
......
...@@ -237,6 +237,7 @@ java.install-info: installdirs ...@@ -237,6 +237,7 @@ java.install-info: installdirs
java.mostlyclean: java.mostlyclean:
-rm -f java/*$(objext) $(DEMANGLER_PROG) -rm -f java/*$(objext) $(DEMANGLER_PROG)
-rm -f java/*$(coverageexts) -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 -rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext) s-java
java.clean: java.clean:
java.distclean: java.distclean:
......
...@@ -35,9 +35,7 @@ extern HOST_WIDE_INT hook_get_alias_set_0 PARAMS ((tree)); ...@@ -35,9 +35,7 @@ extern HOST_WIDE_INT hook_get_alias_set_0 PARAMS ((tree));
The macros in this file should NOT be surrounded by a The macros in this file should NOT be surrounded by a
#ifdef...#endif pair, since this file declares the defaults. Each #ifdef...#endif pair, since this file declares the defaults. Each
front end overrides any hooks it wishes to, in the file containing front end overrides any hooks it wishes to, in the file containing
its struct lang_hooks, AFTER including this file. its struct lang_hooks, AFTER including this file. */
Prefix all default hooks with "lhd_". */
/* See langhooks.h for the definition and documentation of each hook. */ /* See langhooks.h for the definition and documentation of each hook. */
...@@ -45,7 +43,6 @@ extern void lhd_do_nothing PARAMS ((void)); ...@@ -45,7 +43,6 @@ extern void lhd_do_nothing PARAMS ((void));
extern void lhd_do_nothing_t PARAMS ((tree)); extern void lhd_do_nothing_t PARAMS ((tree));
extern void lhd_do_nothing_i PARAMS ((int)); extern void lhd_do_nothing_i PARAMS ((int));
extern void lhd_do_nothing_f PARAMS ((struct function *)); extern void lhd_do_nothing_f PARAMS ((struct function *));
extern int lhd_decode_option PARAMS ((int, char **));
extern bool lhd_post_options PARAMS ((const char **)); extern bool lhd_post_options PARAMS ((const char **));
extern HOST_WIDE_INT lhd_get_alias_set PARAMS ((tree)); extern HOST_WIDE_INT lhd_get_alias_set PARAMS ((tree));
extern tree lhd_return_tree PARAMS ((tree)); extern tree lhd_return_tree PARAMS ((tree));
...@@ -94,8 +91,7 @@ void write_global_declarations PARAMS ((void)); ...@@ -94,8 +91,7 @@ void write_global_declarations PARAMS ((void));
#define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i #define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i
#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack #define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack
#define LANG_HOOKS_INIT_OPTIONS hook_int_void_0 #define LANG_HOOKS_INIT_OPTIONS hook_int_void_0
#define LANG_HOOKS_DECODE_OPTION lhd_decode_option #define LANG_HOOKS_HANDLE_OPTION hook_int_size_t_constharptr_int_0
#define LANG_HOOKS_HANDLE_OPTION NULL
#define LANG_HOOKS_POST_OPTIONS lhd_post_options #define LANG_HOOKS_POST_OPTIONS lhd_post_options
#define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set #define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set
#define LANG_HOOKS_EXPAND_CONSTANT lhd_return_tree #define LANG_HOOKS_EXPAND_CONSTANT lhd_return_tree
...@@ -246,7 +242,6 @@ int lhd_tree_dump_type_quals PARAMS ((tree)); ...@@ -246,7 +242,6 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
LANG_HOOKS_IDENTIFIER_SIZE, \ LANG_HOOKS_IDENTIFIER_SIZE, \
LANG_HOOKS_TREE_SIZE, \ LANG_HOOKS_TREE_SIZE, \
LANG_HOOKS_INIT_OPTIONS, \ LANG_HOOKS_INIT_OPTIONS, \
LANG_HOOKS_DECODE_OPTION, \
LANG_HOOKS_HANDLE_OPTION, \ LANG_HOOKS_HANDLE_OPTION, \
LANG_HOOKS_POST_OPTIONS, \ LANG_HOOKS_POST_OPTIONS, \
LANG_HOOKS_INIT, \ LANG_HOOKS_INIT, \
......
...@@ -83,16 +83,6 @@ lhd_return_null_tree (t) ...@@ -83,16 +83,6 @@ lhd_return_null_tree (t)
return NULL_TREE; return NULL_TREE;
} }
/* Do nothing; the default hook to decode an option. */
int
lhd_decode_option (argc, argv)
int argc ATTRIBUTE_UNUSED;
char **argv ATTRIBUTE_UNUSED;
{
return 0;
}
/* The default post options hook. */ /* The default post options hook. */
bool bool
......
...@@ -206,16 +206,6 @@ struct lang_hooks ...@@ -206,16 +206,6 @@ struct lang_hooks
the language mask to filter the switch array with. */ the language mask to filter the switch array with. */
int (*init_options) PARAMS ((void)); int (*init_options) PARAMS ((void));
/* Function called with an option vector as argument, to decode a
single option (typically starting with -f or -W or +). It should
return the number of command-line arguments it uses if it handles
the option, or 0 and not complain if it does not recognize the
option. If this function returns a negative number, then its
absolute value is the number of command-line arguments used, but,
in addition, no language-independent option processing should be
done for this option. Obsoleted by handle_option. */
int (*decode_option) PARAMS ((int, char **));
/* Handle the switch CODE, which has real type enum opt_code from /* Handle the switch CODE, which has real type enum opt_code from
options.h. If the switch takes an argument, it is passed in ARG options.h. If the switch takes an argument, it is passed in ARG
which points to permanent storage. The handler is resonsible for which points to permanent storage. The handler is resonsible for
......
...@@ -118,7 +118,7 @@ find_opt (const char *input, int lang_mask) ...@@ -118,7 +118,7 @@ find_opt (const char *input, int lang_mask)
/* Handle the switch beginning at ARGV, with ARGC remaining. */ /* Handle the switch beginning at ARGV, with ARGC remaining. */
int int
handle_option (int argc, char **argv, int lang_mask) handle_option (int argc ATTRIBUTE_UNUSED, char **argv, int lang_mask)
{ {
size_t opt_index; size_t opt_index;
const char *opt, *arg = 0; const char *opt, *arg = 0;
...@@ -127,10 +127,6 @@ handle_option (int argc, char **argv, int lang_mask) ...@@ -127,10 +127,6 @@ handle_option (int argc, char **argv, int lang_mask)
int result = 0, temp; int result = 0, temp;
const struct cl_option *option; const struct cl_option *option;
/* If the front end isn't yet converted, use the old hook. */
if (!lang_hooks.handle_option)
return (*lang_hooks.decode_option) (argc, argv);
opt = argv[0]; opt = argv[0];
/* Interpret "-" or a non-switch as a file name. */ /* Interpret "-" or a non-switch as a file name. */
......
2003-06-11 Neil Booth <neil@daikokuya.co.uk>
* Make-lang.in: Update for option handling.
* lang.opt: New.
* tree1.c: Include opts.h and t-options.h.
(treelang_decode_option): Remove.
(treelang_handle_option): New.
* treetree.c (LANG_HOOKS_DECODE_OPTION): Remove.
(LANG_HOOKS_HANDLE_OPTION): Override.
* treetree.h (treelang_decode_option): Remove.
(treelang_handle_option): New.
2003-06-08 Andreas Jaeger <aj@suse.de> 2003-06-08 Andreas Jaeger <aj@suse.de>
* Make-lang.in: Update. * Make-lang.in: Update.
......
...@@ -85,11 +85,11 @@ treelang.done: tree1$(exeext) ...@@ -85,11 +85,11 @@ treelang.done: tree1$(exeext)
# core compiler # core compiler
tree1$(exeext): treelang/tree1.o treelang/treetree.o treelang/lex.o treelang/parse.o\ 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 \ $(TREE_BE_LIBS) c-convert.o c-typeck.o c-common.o c-cppbuiltin.o \
c-decl.o attribs.o c-decl.o attribs.o treelang/t-options.o
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
treelang/tree1.o treelang/treetree.o treelang/lex.o treelang/parse.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 \ c-convert.o c-typeck.o c-common.o c-cppbuiltin.o c-decl.o attribs.o \
$(TREE_BE_LIBS) $(TREE_BE_LIBS) treelang/t-options.o
# #
# Compiling object files from source files. # Compiling object files from source files.
...@@ -98,7 +98,7 @@ tree1$(exeext): treelang/tree1.o treelang/treetree.o treelang/lex.o treelang/par ...@@ -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) \ 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 \ flags.h toplev.h $(GGC_H) $(TREE_H) diagnostic.h treelang/treelang.h \
input.h treelang/treetree.h \ input.h treelang/treetree.h treelang/t-options.h \
treelang/treetree.h gt-treelang-tree1.h gtype-treelang.h treelang/treetree.h gt-treelang-tree1.h gtype-treelang.h
treelang/treetree.o: treelang/treetree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ treelang/treetree.o: treelang/treetree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
...@@ -112,6 +112,12 @@ treelang/parse.o: treelang/parse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ...@@ -112,6 +112,12 @@ treelang/parse.o: treelang/parse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
treelang/lex.o: treelang/lex.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 $(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 # generated files the files from lex and yacc are put into the source
# directory in case someone wants to build but does not have # directory in case someone wants to build but does not have
# lex/yacc # lex/yacc
...@@ -122,6 +128,7 @@ $(srcdir)/treelang/lex.c: $(srcdir)/treelang/lex.l ...@@ -122,6 +128,7 @@ $(srcdir)/treelang/lex.c: $(srcdir)/treelang/lex.l
$(srcdir)/treelang/parse.c $(srcdir)/treelang/parse.h: $(srcdir)/treelang/parse.y $(srcdir)/treelang/parse.c $(srcdir)/treelang/parse.h: $(srcdir)/treelang/parse.y
$(BISON) $(BISONFLAGS) -v --defines \ $(BISON) $(BISONFLAGS) -v --defines \
--output=$(srcdir)/treelang/parse.c $(srcdir)/treelang/parse.y --output=$(srcdir)/treelang/parse.c $(srcdir)/treelang/parse.y
# -v # -v
gt-treelang-tree1.h gtype-treelang.h : s-gtype; @true gt-treelang-tree1.h gtype-treelang.h : s-gtype; @true
...@@ -230,6 +237,7 @@ treelang.mostlyclean: ...@@ -230,6 +237,7 @@ treelang.mostlyclean:
rm -f treelang/$$name$(exeext); \ rm -f treelang/$$name$(exeext); \
fi ; \ fi ; \
done done
-rm -f treelang/t-options.c treelang/t-options.h
-rm -f treelang/*$(objext) -rm -f treelang/*$(objext)
-rm -f treelang/*$(coverageexts) -rm -f treelang/*$(coverageexts)
-rm treelang.done -rm treelang.done
......
; Options for the treelang 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 "Tree". 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.
-help
Tree
flexer-trace
Tree
fparser-trace
Tree
v
Tree
y
Tree
; This comment is to ensure we retain the blank line above.
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
#include "treelang.h" #include "treelang.h"
#include "treetree.h" #include "treetree.h"
#include "opts.h"
#include "t-options.h"
extern int yyparse (void); extern int yyparse (void);
...@@ -86,98 +88,54 @@ static int version_done = 0; ...@@ -86,98 +88,54 @@ static int version_done = 0;
static unsigned int work_nesting_level = 0; static unsigned int work_nesting_level = 0;
/* Process one switch - called by toplev.c. */ /* Process a switch - called by opts.c. */
int int
treelang_decode_option (num_options_left, first_option_left) treelang_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED,
int num_options_left ATTRIBUTE_UNUSED; int value)
char** first_option_left;
{ {
enum opt_code code = (enum opt_code) scode;
/*
Process options - bear in mind I may get options that are really
meant for someone else (eg the main compiler) so I have to be very
permissive.
*/
if (first_option_left[0][0] != '-')
return 0;
switch (first_option_left[0][1])
{
case '-':
if (!strcmp (first_option_left[0],"--help"))
{
if (!version_done)
{
fputs (language_string, stdout);
fputs (version_string, stdout);
fputs ("\n", stdout);
version_done = 1;
}
fprintf (stdout, "Usage: tree1 [switches] -o output input\n");
return 1;
}
break;
case 'v': switch (code)
if (!strcmp (first_option_left[0],"-v")) {
{ default:
if (!version_done) return 0;
{
fputs (language_string, stdout);
fputs (version_string, stdout);
fputs ("\n", stdout);
version_done = 1;
}
return 1;
}
break;
case 'y': case OPT__help:
if (!strcmp (first_option_left[0],"-y")) if (!version_done)
{ {
option_lexer_trace = 1; fputs (language_string, stdout);
option_parser_trace = 1; fputs (version_string, stdout);
return 1; fputs ("\n", stdout);
} version_done = 1;
}
fprintf (stdout, "Usage: tree1 [switches] -o output input\n");
break; break;
case 'f': case OPT_v:
if (!strcmp (first_option_left[0],"-fparser-trace")) if (!version_done)
{ {
option_parser_trace = 1; fputs (language_string, stdout);
return 1; fputs (version_string, stdout);
} fputs ("\n", stdout);
if (!strcmp (first_option_left[0],"-flexer-trace")) version_done = 1;
{ }
option_lexer_trace = 1;
return 1;
}
break; break;
case 'w': case OPT_y:
if (!strcmp (first_option_left[0],"-w")) option_lexer_trace = 1;
{ option_parser_trace = 1;
/* Tolerate this option but ignore it - we always put out
all warnings. */
return 1;
}
break; break;
case 'W': case OPT_fparser_trace:
if (!strcmp (first_option_left[0],"-Wall")) option_parser_trace = value;
{
return 1;
}
break; break;
default: case OPT_flexer_trace:
option_lexer_trace = value;
break; break;
} }
return 0; return 1;
} }
/* Language dependent parser setup. */ /* Language dependent parser setup. */
......
...@@ -114,8 +114,8 @@ extern char **file_names; ...@@ -114,8 +114,8 @@ extern char **file_names;
#define LANG_HOOKS_NAME "GNU treelang" #define LANG_HOOKS_NAME "GNU treelang"
#undef LANG_HOOKS_FINISH #undef LANG_HOOKS_FINISH
#define LANG_HOOKS_FINISH treelang_finish #define LANG_HOOKS_FINISH treelang_finish
#undef LANG_HOOKS_DECODE_OPTION #undef LANG_HOOKS_HANDLE_OPTION
#define LANG_HOOKS_DECODE_OPTION treelang_decode_option #define LANG_HOOKS_HANDLE_OPTION treelang_handle_option
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
/* Tree code type/name/code tables. */ /* Tree code type/name/code tables. */
......
...@@ -63,7 +63,7 @@ tree tree_code_get_type (int type_num); ...@@ -63,7 +63,7 @@ tree tree_code_get_type (int type_num);
void treelang_init_decl_processing (void); void treelang_init_decl_processing (void);
void treelang_finish (void); void treelang_finish (void);
bool treelang_init (void); bool treelang_init (void);
int treelang_decode_option (int, char **); int treelang_handle_option (size_t scode, const char *arg, int value);
void treelang_parse_file (int debug_flag); void treelang_parse_file (int debug_flag);
void push_var_level (void); void push_var_level (void);
void pop_var_level (void); void pop_var_level (void);
......
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