diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2003-06-08 14:42:06 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2003-06-08 14:42:06 +0000 |
commit | 2cdfea3ae80f8952df6bae07d7ebf6c0fceecc51 (patch) | |
tree | c2c30f96aa74213a4a406c1277d222ad47eaa584 /gcc | |
parent | d79d6feaa13a134680113b32b5c50180b882761b (diff) | |
download | gcc-2cdfea3ae80f8952df6bae07d7ebf6c0fceecc51.zip gcc-2cdfea3ae80f8952df6bae07d7ebf6c0fceecc51.tar.gz gcc-2cdfea3ae80f8952df6bae07d7ebf6c0fceecc51.tar.bz2 |
Make-lang.in (F77_OBJS, [...]): Update.
* Make-lang.in (F77_OBJS, f77.mostlyclean, f/com.o): Update.
(f/f-options.c, f/f-options.h): New.
* com.c: Include opts.h and f-options.h.
(ffecom_decode_include_option_): Remove.
(LANG_HOOKS_HANDLE_OPTION): New.
(LANG_HOOKS_DECODE_OPTION): Drop.
(struct file_name_list, ffecom_decode_include_option,
ffecom_open_include_): Constify.
* com.h (ffecom_decode_include_option): Update.
* lang.opt: New.
* top.c: Include f-options.h, opts.h.
(ffe_is_digit_string_): Constify.
(ffe_decode_option): Transform to ffe_handle_option.
* top.h (ffe_decode_option): Replace with ffe_handle_option.
From-SVN: r67628
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/f/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/f/Make-lang.in | 11 | ||||
-rw-r--r-- | gcc/f/com.c | 40 | ||||
-rw-r--r-- | gcc/f/com.h | 2 | ||||
-rw-r--r-- | gcc/f/lang.opt | 329 | ||||
-rw-r--r-- | gcc/f/top.c | 789 | ||||
-rw-r--r-- | gcc/f/top.h | 2 |
7 files changed, 802 insertions, 388 deletions
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 764fcad..632cd09 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,20 @@ +Sun Jun 8 15:42:09 2003 Neil Booth <neil@daikokuya.co.uk> + + * Make-lang.in (F77_OBJS, f77.mostlyclean, f/com.o): Update. + (f/f-options.c, f/f-options.h): New. + * com.c: Include opts.h and f-options.h. + (ffecom_decode_include_option_): Remove. + (LANG_HOOKS_HANDLE_OPTION): New. + (LANG_HOOKS_DECODE_OPTION): Drop. + (struct file_name_list, ffecom_decode_include_option, + ffecom_open_include_): Constify. + * com.h (ffecom_decode_include_option): Update. + * lang.opt: New. + * top.c: Include f-options.h, opts.h. + (ffe_is_digit_string_): Constify. + (ffe_decode_option): Transform to ffe_handle_option. + * top.h (ffe_decode_option): Replace with ffe_handle_option. + 2003-06-08 Andreas Jaeger <aj@suse.de> * std.c: Remove #if 0'ed functions. diff --git a/gcc/f/Make-lang.in b/gcc/f/Make-lang.in index bf7b99c..0fe264b 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/parse.o f/src.o f/st.o f/sta.o f/stb.o f/stc.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/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,6 +320,7 @@ 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 \ @@ -542,8 +543,14 @@ 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 + toplev.h coretypes.h $(TM_H) opts.h f/f-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 568cb21..ce821c7 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -389,7 +389,6 @@ static tree start_decl (tree decl, bool is_top_level); static void start_function (tree name, tree type, int nested, int public); static void ffecom_file_ (const char *name); static void ffecom_close_include_ (FILE *f); -static int ffecom_decode_include_option_ (char *spec); static FILE *ffecom_open_include_ (char *name, ffewhereLine l, ffewhereColumn c); @@ -10697,12 +10696,6 @@ ffecom_close_include (FILE *f) ffecom_close_include_ (f); } -int -ffecom_decode_include_option (char *spec) -{ - return ffecom_decode_include_option_ (spec); -} - /* End a compound statement (block). */ tree @@ -14148,8 +14141,8 @@ struct language_function GTY(()) #define LANG_HOOKS_FINISH ffe_finish #undef LANG_HOOKS_INIT_OPTIONS #define LANG_HOOKS_INIT_OPTIONS ffe_init_options -#undef LANG_HOOKS_DECODE_OPTION -#define LANG_HOOKS_DECODE_OPTION ffe_decode_option +#undef LANG_HOOKS_HANDLE_OPTION +#define LANG_HOOKS_HANDLE_OPTION ffe_handle_option #undef LANG_HOOKS_POST_OPTIONS #define LANG_HOOKS_POST_OPTIONS ffe_post_options #undef LANG_HOOKS_PARSE_FILE @@ -15119,7 +15112,7 @@ static int max_include_len = 0; struct file_name_list { struct file_name_list *next; - char *fname; + const char *fname; /* Mapping of file names for this directory. */ struct file_name_map *name_map; /* Nonzero if name_map is valid. */ @@ -15486,26 +15479,20 @@ ffecom_close_include_ (FILE *f) ffewhere_column_kill (instack[indepth].column); } -static int -ffecom_decode_include_option_ (char *spec) +void +ffecom_decode_include_option (const char *dir) { - struct file_name_list *dirtmp; - - if (! ignore_srcdir && !strcmp (spec, "-")) + if (! ignore_srcdir && !strcmp (dir, "-")) ignore_srcdir = 1; else { - dirtmp = (struct file_name_list *) + struct file_name_list *dirtmp = (struct file_name_list *) xmalloc (sizeof (struct file_name_list)); dirtmp->next = 0; /* New one goes on the end */ - dirtmp->fname = spec; + dirtmp->fname = dir; dirtmp->got_name_map = 0; - if (spec[0] == 0) - error ("directory name must immediately follow -I"); - else - append_include_chain (dirtmp, dirtmp); + append_include_chain (dirtmp, dirtmp); } - return 1; } /* Open INCLUDEd file. */ @@ -15560,9 +15547,10 @@ ffecom_open_include_ (char *name, ffewhereLine l, ffewhereColumn c) if (ep != NULL) { n = ep - nam; - dsp[0].fname = (char *) xmalloc (n + 1); - strncpy (dsp[0].fname, nam, n); - dsp[0].fname[n] = '\0'; + fname = xmalloc (n + 1); + strncpy (fname, nam, n); + fname[n] = '\0'; + dsp[0].fname = fname; if (n + INCLUDE_LEN_FUDGE > max_include_len) max_include_len = n + INCLUDE_LEN_FUDGE; } @@ -15670,7 +15658,7 @@ ffecom_open_include_ (char *name, ffewhereLine l, ffewhereColumn c) } if (dsp[0].fname != NULL) - free (dsp[0].fname); + free ((char *) dsp[0].fname); if (f == NULL) return NULL; diff --git a/gcc/f/com.h b/gcc/f/com.h index 5ed9096..5036251 100644 --- a/gcc/f/com.h +++ b/gcc/f/com.h @@ -213,7 +213,7 @@ tree ffecom_const_expr (ffebld expr); tree ffecom_decl_field (tree context, tree prevfield, const char *name, tree type); void ffecom_close_include (FILE *f); -int ffecom_decode_include_option (char *spec); +void ffecom_decode_include_option (const char *dir); tree ffecom_end_compstmt (void); void ffecom_end_transition (void); void ffecom_exec_transition (void); diff --git a/gcc/f/lang.opt b/gcc/f/lang.opt new file mode 100644 index 0000000..327556f --- /dev/null +++ b/gcc/f/lang.opt @@ -0,0 +1,329 @@ +; Options for the Fortran 77 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 "F77". 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 +F77 Joined + +Wall +F77 + +Wcomment +F77 + +Wcomments +F77 + +Wglobals +F77 + +Wimplicit +F77 + +Wimport +F77 + +Wsurprising +F77 + +Wtrigraphs +F77 + +fautomatic +F77 + +fbackslash +F77 + +fbadu77-intrinsics-delete +F77 RejectNegative + +fbadu77-intrinsics-disable +F77 RejectNegative + +fbadu77-intrinsics-enable +F77 RejectNegative + +fbadu77-intrinsics-hide +F77 RejectNegative + +fcase-initcap +F77 RejectNegative + +fcase-lower +F77 RejectNegative + +fcase-preserve +F77 RejectNegative + +fcase-strict-lower +F77 RejectNegative + +fcase-strict-upper +F77 RejectNegative + +fcase-upper +F77 RejectNegative + +fdebug-kludge +F77 + +fdollar-ok +F77 + +femulate-complex +F77 + +ff2c +F77 + +ff2c-intrinsics-delete +F77 RejectNegative + +ff2c-intrinsics-disable +F77 RejectNegative + +ff2c-intrinsics-enable +F77 RejectNegative + +ff2c-intrinsics-hide +F77 RejectNegative + +ff2c-library +F77 + +ff66 +F77 + +ff77 +F77 + +ff90 +F77 + +ff90-intrinsics-delete +F77 RejectNegative + +ff90-intrinsics-disable +F77 RejectNegative + +ff90-intrinsics-enable +F77 RejectNegative + +ff90-intrinsics-hide +F77 RejectNegative + +ff90-not-vxt +F77 RejectNegative + +ffixed-form +F77 + +ffixed-line-length- +F77 Joined + +fflatten-arrays +F77 + +ffortran-bounds-check +F77 + +ffree-form +F77 + +fglobals +F77 + +fgnu-intrinsics-delete +F77 RejectNegative + +fgnu-intrinsics-disable +F77 RejectNegative + +fgnu-intrinsics-enable +F77 RejectNegative + +fgnu-intrinsics-hide +F77 RejectNegative + +finit-local-zero +F77 + +fintrin-case-any +F77 RejectNegative + +fintrin-case-initcap +F77 RejectNegative + +fintrin-case-lower +F77 RejectNegative + +fintrin-case-upper +F77 RejectNegative + +fmatch-case-any +F77 RejectNegative + +fmatch-case-initcap +F77 RejectNegative + +fmatch-case-lower +F77 RejectNegative + +fmatch-case-upper +F77 RejectNegative + +fmil-intrinsics-delete +F77 RejectNegative + +fmil-intrinsics-disable +F77 RejectNegative + +fmil-intrinsics-enable +F77 RejectNegative + +fmil-intrinsics-hide +F77 RejectNegative + +fonetrip +F77 + +fpedantic +F77 + +fsecond-underscore +F77 + +fsilent +F77 + +fsource-case-lower +F77 RejectNegative + +fsource-case-preserve +F77 RejectNegative + +fsource-case-upper +F77 RejectNegative + +fsymbol-case-any +F77 RejectNegative + +fsymbol-case-initcap +F77 RejectNegative + +fsymbol-case-lower +F77 RejectNegative + +fsymbol-case-upper +F77 RejectNegative + +ftypeless-boz +F77 + +fugly +F77 + +fugly-args +F77 + +fugly-assign +F77 + +fugly-assumed +F77 + +fugly-comma +F77 + +fugly-complex +F77 + +fugly-init +F77 + +fugly-logint +F77 + +funderscoring +F77 + +funix-intrinsics-delete +F77 RejectNegative + +funix-intrinsics-disable +F77 RejectNegative + +funix-intrinsics-enable +F77 RejectNegative + +funix-intrinsics-hide +F77 RejectNegative + +fversion +F77 RejectNegative + +fvxt +F77 + +fvxt-intrinsics-delete +F77 RejectNegative + +fvxt-intrinsics-disable +F77 RejectNegative + +fvxt-intrinsics-enable +F77 RejectNegative + +fvxt-intrinsics-hide +F77 RejectNegative + +fvxt-not-f90 +F77 RejectNegative + +fxyzzy +F77 + +fzeros +F77 + +; This comment is to ensure we retain the blank line above. diff --git a/gcc/f/top.c b/gcc/f/top.c index 597f7af..715e61c 100644 --- a/gcc/f/top.c +++ b/gcc/f/top.c @@ -47,6 +47,8 @@ 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 "opts.h" #include "src.h" #include "st.h" #include "storag.h" @@ -55,13 +57,9 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "where.h" #include "flags.h" #include "toplev.h" -#include "opts.h" /* Externals defined here. */ -const unsigned int cl_options_count; -const struct cl_option cl_options[1]; - bool ffe_is_do_internal_checks_ = FALSE; bool ffe_is_90_ = FFETARGET_defaultIS_90; bool ffe_is_automatic_ = FFETARGET_defaultIS_AUTOMATIC; @@ -142,14 +140,14 @@ bool ffe_in_4 = FALSE; /* Static functions (internal). */ -static bool ffe_is_digit_string_ (char *s); +static bool ffe_is_digit_string_ (const char *s); /* Internal macros. */ static bool -ffe_is_digit_string_ (char *s) +ffe_is_digit_string_ (const char *s) { - char *p; + const char *p; for (p = s; ISDIGIT (*p); ++p) ; @@ -159,371 +157,446 @@ ffe_is_digit_string_ (char *s) /* Handle command-line options. Returns 0 if unrecognized, 1 if recognized and handled. */ - int -ffe_decode_option (int argc ATTRIBUTE_UNUSED, char **argv) +ffe_handle_option (size_t scode, const char *arg, int value) { - char *opt = argv[0]; - if (opt[0] != '-') - return 0; - if (opt[1] == 'f') + const struct cl_option *option = &cl_options[scode]; + enum opt_code code = (enum opt_code) scode; + + /* Ignore file names. */ + if (code == N_OPTS) + return 1; + + if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE))) { - if (strcmp (&opt[2], "version") == 0) - { - ffe_set_is_version (TRUE); - ffe_set_is_do_internal_checks (TRUE); - } - else if (strcmp (&opt[2], "f66") == 0) - { - ffe_set_is_onetrip (TRUE); - ffe_set_is_ugly_assumed (TRUE); - } - else if (strcmp (&opt[2], "no-f66") == 0) - { - ffe_set_is_onetrip (FALSE); - ffe_set_is_ugly_assumed (FALSE); - } - else if (strcmp (&opt[2], "f77") == 0) - { - ffe_set_is_backslash (TRUE); - ffe_set_is_typeless_boz (FALSE); - } - else if (strcmp (&opt[2], "no-f77") == 0) - { - ffe_set_is_backslash (FALSE); - } - else if (strcmp (&opt[2], "f90") == 0) - ffe_set_is_90 (TRUE); - else if (strcmp (&opt[2], "no-f90") == 0) - ffe_set_is_90 (FALSE); - else if (strcmp (&opt[2], "automatic") == 0) - ffe_set_is_automatic (TRUE); - else if (strcmp (&opt[2], "no-automatic") == 0) - ffe_set_is_automatic (FALSE); - else if (strcmp (&opt[2], "dollar-ok") == 0) - ffe_set_is_dollar_ok (TRUE); - else if (strcmp (&opt[2], "no-dollar-ok") == 0) - ffe_set_is_dollar_ok (FALSE); - else if (strcmp (&opt[2], "f2c") == 0) - ffe_set_is_f2c (TRUE); - else if (strcmp (&opt[2], "no-f2c") == 0) - ffe_set_is_f2c (FALSE); - else if (strcmp (&opt[2], "f2c-library") == 0) - ffe_set_is_f2c_library (TRUE); - else if (strcmp (&opt[2], "no-f2c-library") == 0) - ffe_set_is_f2c_library (FALSE); - else if (strcmp (&opt[2], "flatten-arrays") == 0) - ffe_set_is_flatten_arrays (TRUE); - else if (strcmp (&opt[2], "no-flatten-arrays") == 0) - ffe_set_is_flatten_arrays (FALSE); - else if (strcmp (&opt[2], "free-form") == 0) - ffe_set_is_free_form (TRUE); - else if (strcmp (&opt[2], "no-free-form") == 0) - ffe_set_is_free_form (FALSE); - else if (strcmp (&opt[2], "fixed-form") == 0) - { - ffe_set_is_free_form (FALSE); - return -1; - } - else if (strcmp (&opt[2], "no-fixed-form") == 0) - ffe_set_is_free_form (TRUE); - else if (strcmp (&opt[2], "pedantic") == 0) - ffe_set_is_pedantic (TRUE); - else if (strcmp (&opt[2], "no-pedantic") == 0) - ffe_set_is_pedantic (FALSE); - else if (strcmp (&opt[2], "vxt") == 0) - ffe_set_is_vxt (TRUE); - else if (strcmp (&opt[2], "not-vxt") == 0) - ffe_set_is_vxt (FALSE); - else if (strcmp (&opt[2], "vxt-not-f90") == 0) - warning ("%s no longer supported -- try -fvxt", opt); - else if (strcmp (&opt[2], "f90-not-vxt") == 0) - warning ("%s no longer supported -- try -fno-vxt -ff90", opt); - else if (strcmp (&opt[2], "no-ugly") == 0) - { - ffe_set_is_ugly_args (FALSE); - ffe_set_is_ugly_assign (FALSE); - ffe_set_is_ugly_assumed (FALSE); - ffe_set_is_ugly_comma (FALSE); - ffe_set_is_ugly_complex (FALSE); - ffe_set_is_ugly_init (FALSE); - ffe_set_is_ugly_logint (FALSE); - } - else if (strcmp (&opt[2], "ugly-args") == 0) - ffe_set_is_ugly_args (TRUE); - else if (strcmp (&opt[2], "no-ugly-args") == 0) - ffe_set_is_ugly_args (FALSE); - else if (strcmp (&opt[2], "ugly-assign") == 0) - ffe_set_is_ugly_assign (TRUE); - else if (strcmp (&opt[2], "no-ugly-assign") == 0) - ffe_set_is_ugly_assign (FALSE); - else if (strcmp (&opt[2], "ugly-assumed") == 0) - ffe_set_is_ugly_assumed (TRUE); - else if (strcmp (&opt[2], "no-ugly-assumed") == 0) - ffe_set_is_ugly_assumed (FALSE); - else if (strcmp (&opt[2], "ugly-comma") == 0) - ffe_set_is_ugly_comma (TRUE); - else if (strcmp (&opt[2], "no-ugly-comma") == 0) - ffe_set_is_ugly_comma (FALSE); - else if (strcmp (&opt[2], "ugly-complex") == 0) - ffe_set_is_ugly_complex (TRUE); - else if (strcmp (&opt[2], "no-ugly-complex") == 0) - ffe_set_is_ugly_complex (FALSE); - else if (strcmp (&opt[2], "ugly-init") == 0) - ffe_set_is_ugly_init (TRUE); - else if (strcmp (&opt[2], "no-ugly-init") == 0) - ffe_set_is_ugly_init (FALSE); - else if (strcmp (&opt[2], "ugly-logint") == 0) - ffe_set_is_ugly_logint (TRUE); - else if (strcmp (&opt[2], "no-ugly-logint") == 0) - ffe_set_is_ugly_logint (FALSE); - else if (strcmp (&opt[2], "xyzzy") == 0) - ffe_set_is_ffedebug (TRUE); - else if (strcmp (&opt[2], "no-xyzzy") == 0) - ffe_set_is_ffedebug (FALSE); - else if (strcmp (&opt[2], "init-local-zero") == 0) - ffe_set_is_init_local_zero (TRUE); - else if (strcmp (&opt[2], "no-init-local-zero") == 0) - ffe_set_is_init_local_zero (FALSE); - else if (strcmp (&opt[2], "emulate-complex") == 0) - ffe_set_is_emulate_complex (TRUE); - else if (strcmp (&opt[2], "no-emulate-complex") == 0) - ffe_set_is_emulate_complex (FALSE); - else if (strcmp (&opt[2], "backslash") == 0) - ffe_set_is_backslash (TRUE); - else if (strcmp (&opt[2], "no-backslash") == 0) - ffe_set_is_backslash (FALSE); - else if (strcmp (&opt[2], "underscoring") == 0) - ffe_set_is_underscoring (TRUE); - else if (strcmp (&opt[2], "no-underscoring") == 0) - ffe_set_is_underscoring (FALSE); - else if (strcmp (&opt[2], "second-underscore") == 0) - ffe_set_is_second_underscore (TRUE); - else if (strcmp (&opt[2], "no-second-underscore") == 0) - ffe_set_is_second_underscore (FALSE); - else if (strcmp (&opt[2], "zeros") == 0) - ffe_set_is_zeros (TRUE); - else if (strcmp (&opt[2], "no-zeros") == 0) - ffe_set_is_zeros (FALSE); - else if (strcmp (&opt[2], "debug-kludge") == 0) - warning ("%s disabled, use normal debugging flags", opt); - else if (strcmp (&opt[2], "no-debug-kludge") == 0) - warning ("%s disabled, use normal debugging flags", opt); - else if (strcmp (&opt[2], "onetrip") == 0) - ffe_set_is_onetrip (TRUE); - else if (strcmp (&opt[2], "no-onetrip") == 0) - ffe_set_is_onetrip (FALSE); - else if (strcmp (&opt[2], "silent") == 0) - ffe_set_is_silent (TRUE); - else if (strcmp (&opt[2], "no-silent") == 0) - ffe_set_is_silent (FALSE); - else if (strcmp (&opt[2], "globals") == 0) - ffe_set_is_globals (TRUE); - else if (strcmp (&opt[2], "no-globals") == 0) - ffe_set_is_globals (FALSE); - else if (strcmp (&opt[2], "fortran-bounds-check") == 0) - flag_bounds_check = TRUE; - else if (strcmp (&opt[2], "no-fortran-bounds-check") == 0) - flag_bounds_check = FALSE; - else if (strcmp (&opt[2], "typeless-boz") == 0) - ffe_set_is_typeless_boz (TRUE); - else if (strcmp (&opt[2], "no-typeless-boz") == 0) + error ("missing argument to \"-%s\"", option->opt_text); + return 1; + } + + switch (code) + { + default: + return 0; + + case OPT_fversion: + ffe_set_is_version (TRUE); + ffe_set_is_do_internal_checks (TRUE); + break; + + case OPT_ff66: + ffe_set_is_onetrip (value); + ffe_set_is_ugly_assumed (value); + break; + + case OPT_ff77: + ffe_set_is_backslash (value); + if (value) ffe_set_is_typeless_boz (FALSE); - else if (strcmp (&opt[2], "intrin-case-initcap") == 0) - ffe_set_case_intrin (FFE_caseINITCAP); - else if (strcmp (&opt[2], "intrin-case-upper") == 0) - ffe_set_case_intrin (FFE_caseUPPER); - else if (strcmp (&opt[2], "intrin-case-lower") == 0) - ffe_set_case_intrin (FFE_caseLOWER); - else if (strcmp (&opt[2], "intrin-case-any") == 0) - ffe_set_case_intrin (FFE_caseNONE); - else if (strcmp (&opt[2], "match-case-initcap") == 0) - ffe_set_case_match (FFE_caseINITCAP); - else if (strcmp (&opt[2], "match-case-upper") == 0) - ffe_set_case_match (FFE_caseUPPER); - else if (strcmp (&opt[2], "match-case-lower") == 0) - ffe_set_case_match (FFE_caseLOWER); - else if (strcmp (&opt[2], "match-case-any") == 0) - ffe_set_case_match (FFE_caseNONE); - else if (strcmp (&opt[2], "source-case-upper") == 0) - ffe_set_case_source (FFE_caseUPPER); - else if (strcmp (&opt[2], "source-case-lower") == 0) - ffe_set_case_source (FFE_caseLOWER); - else if (strcmp (&opt[2], "source-case-preserve") == 0) - ffe_set_case_source (FFE_caseNONE); - else if (strcmp (&opt[2], "symbol-case-initcap") == 0) - ffe_set_case_symbol (FFE_caseINITCAP); - else if (strcmp (&opt[2], "symbol-case-upper") == 0) - ffe_set_case_symbol (FFE_caseUPPER); - else if (strcmp (&opt[2], "symbol-case-lower") == 0) - ffe_set_case_symbol (FFE_caseLOWER); - else if (strcmp (&opt[2], "symbol-case-any") == 0) - ffe_set_case_symbol (FFE_caseNONE); - else if (strcmp (&opt[2], "case-strict-upper") == 0) - { - ffe_set_case_intrin (FFE_caseUPPER); - ffe_set_case_match (FFE_caseUPPER); - ffe_set_case_source (FFE_caseNONE); - ffe_set_case_symbol (FFE_caseUPPER); - } - else if (strcmp (&opt[2], "case-strict-lower") == 0) - { - ffe_set_case_intrin (FFE_caseLOWER); - ffe_set_case_match (FFE_caseLOWER); - ffe_set_case_source (FFE_caseNONE); - ffe_set_case_symbol (FFE_caseLOWER); - } - else if (strcmp (&opt[2], "case-initcap") == 0) - { - ffe_set_case_intrin (FFE_caseINITCAP); - ffe_set_case_match (FFE_caseINITCAP); - ffe_set_case_source (FFE_caseNONE); - ffe_set_case_symbol (FFE_caseINITCAP); - } - else if (strcmp (&opt[2], "case-upper") == 0) - { - ffe_set_case_intrin (FFE_caseNONE); - ffe_set_case_match (FFE_caseNONE); - ffe_set_case_source (FFE_caseUPPER); - ffe_set_case_symbol (FFE_caseNONE); - } - else if (strcmp (&opt[2], "case-lower") == 0) - { - ffe_set_case_intrin (FFE_caseNONE); - ffe_set_case_match (FFE_caseNONE); - ffe_set_case_source (FFE_caseLOWER); - ffe_set_case_symbol (FFE_caseNONE); - } - else if (strcmp (&opt[2], "case-preserve") == 0) + break; + + case OPT_ff90: + ffe_set_is_90 (value); + break; + + case OPT_fautomatic: + ffe_set_is_automatic (value); + break; + + case OPT_fdollar_ok: + ffe_set_is_dollar_ok (value); + break; + + case OPT_ff2c: + ffe_set_is_f2c (value); + break; + + case OPT_ff2c_library: + ffe_set_is_f2c_library (value); + break; + + case OPT_fflatten_arrays: + ffe_set_is_f2c_library (value); + break; + + case OPT_ffree_form: + ffe_set_is_free_form (value); + break; + + case OPT_ffixed_form: + ffe_set_is_free_form (!value); + if (value) + return -1; + break; + + case OPT_fpedantic: + ffe_set_is_pedantic (value); + break; + + case OPT_fvxt: + ffe_set_is_vxt (value); + break; + + case OPT_fvxt_not_f90: + warning ("-fvxt-not-f90 no longer supported -- try -fvxt"); + break; + + case OPT_ff90_not_vxt: + warning ("-ff90-not-vxt no longer supported -- try -fno-vxt -ff90"); + break; + + case OPT_fugly: + ffe_set_is_ugly_args (value); + ffe_set_is_ugly_assign (value); + ffe_set_is_ugly_assumed (value); + ffe_set_is_ugly_comma (value); + ffe_set_is_ugly_complex (value); + ffe_set_is_ugly_init (value); + ffe_set_is_ugly_logint (value); + break; + + case OPT_fugly_args: + ffe_set_is_ugly_args (value); + break; + + case OPT_fugly_assign: + ffe_set_is_ugly_assign (value); + break; + + case OPT_fugly_assumed: + ffe_set_is_ugly_assumed (value); + break; + + case OPT_fugly_comma: + ffe_set_is_ugly_comma (value); + break; + + case OPT_fugly_complex: + ffe_set_is_ugly_complex (value); + break; + + case OPT_fugly_init: + ffe_set_is_ugly_init (value); + break; + + case OPT_fugly_logint: + ffe_set_is_ugly_logint (value); + break; + + case OPT_fxyzzy: + ffe_set_is_ffedebug (value); + break; + + case OPT_finit_local_zero: + ffe_set_is_init_local_zero (value); + break; + + case OPT_femulate_complex: + ffe_set_is_emulate_complex (value); + break; + + case OPT_fbackslash: + ffe_set_is_backslash (value); + break; + + case OPT_funderscoring: + ffe_set_is_underscoring (value); + break; + + case OPT_fsecond_underscore: + ffe_set_is_second_underscore (value); + break; + + case OPT_fzeros: + ffe_set_is_zeros (value); + break; + + case OPT_fdebug_kludge: + warning ("-fdebug-kludge is disabled, use normal debugging flags"); + break; + + case OPT_fonetrip: + ffe_set_is_onetrip (value); + break; + + case OPT_fsilent: + ffe_set_is_silent (value); + break; + + case OPT_fglobals: + ffe_set_is_globals (value); + break; + + case OPT_ffortran_bounds_check: + flag_bounds_check = value; + break; + + case OPT_ftypeless_boz: + ffe_set_is_typeless_boz (value); + break; + + case OPT_fintrin_case_initcap: + ffe_set_case_intrin (FFE_caseINITCAP); + break; + + case OPT_fintrin_case_lower: + ffe_set_case_intrin (FFE_caseLOWER); + break; + + case OPT_fintrin_case_upper: + ffe_set_case_intrin (FFE_caseUPPER); + break; + + case OPT_fintrin_case_any: + ffe_set_case_intrin (FFE_caseNONE); + break; + + case OPT_fmatch_case_initcap: + ffe_set_case_match (FFE_caseINITCAP); + break; + + case OPT_fmatch_case_lower: + ffe_set_case_match (FFE_caseLOWER); + break; + + case OPT_fmatch_case_upper: + ffe_set_case_match (FFE_caseUPPER); + break; + + case OPT_fmatch_case_any: + ffe_set_case_match (FFE_caseNONE); + break; + + case OPT_fsource_case_lower: + ffe_set_case_source (FFE_caseLOWER); + break; + + case OPT_fsource_case_preserve: + ffe_set_case_match (FFE_caseNONE); + break; + + case OPT_fsource_case_upper: + ffe_set_case_source (FFE_caseUPPER); + break; + + case OPT_fsymbol_case_initcap: + ffe_set_case_symbol (FFE_caseINITCAP); + break; + + case OPT_fsymbol_case_lower: + ffe_set_case_symbol (FFE_caseLOWER); + break; + + case OPT_fsymbol_case_upper: + ffe_set_case_symbol (FFE_caseUPPER); + break; + + case OPT_fsymbol_case_any: + ffe_set_case_symbol (FFE_caseNONE); + break; + + case OPT_fcase_strict_upper: + ffe_set_case_intrin (FFE_caseUPPER); + ffe_set_case_match (FFE_caseUPPER); + ffe_set_case_source (FFE_caseNONE); + ffe_set_case_symbol (FFE_caseUPPER); + break; + + case OPT_fcase_strict_lower: + ffe_set_case_intrin (FFE_caseLOWER); + ffe_set_case_match (FFE_caseLOWER); + ffe_set_case_source (FFE_caseNONE); + ffe_set_case_symbol (FFE_caseLOWER); + break; + + case OPT_fcase_initcap: + ffe_set_case_intrin (FFE_caseINITCAP); + ffe_set_case_match (FFE_caseINITCAP); + ffe_set_case_source (FFE_caseNONE); + ffe_set_case_symbol (FFE_caseINITCAP); + break; + + case OPT_fcase_upper: + ffe_set_case_intrin (FFE_caseNONE); + ffe_set_case_match (FFE_caseNONE); + ffe_set_case_source (FFE_caseUPPER); + ffe_set_case_symbol (FFE_caseNONE); + break; + + case OPT_fcase_lower: + ffe_set_case_intrin (FFE_caseNONE); + ffe_set_case_match (FFE_caseNONE); + ffe_set_case_source (FFE_caseLOWER); + ffe_set_case_symbol (FFE_caseNONE); + + case OPT_fcase_preserve: + ffe_set_case_intrin (FFE_caseNONE); + ffe_set_case_match (FFE_caseNONE); + ffe_set_case_source (FFE_caseNONE); + ffe_set_case_symbol (FFE_caseNONE); + break; + + case OPT_fbadu77_intrinsics_delete: + ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateDELETED); + break; + + case OPT_fbadu77_intrinsics_hide: + ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateHIDDEN); + break; + + case OPT_fbadu77_intrinsics_disable: + ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateDISABLED); + break; + + case OPT_fbadu77_intrinsics_enable: + ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateENABLED); + break; + + case OPT_fgnu_intrinsics_delete: + ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDELETED); + break; + + case OPT_fgnu_intrinsics_hide: + ffe_set_intrinsic_state_gnu (FFE_intrinsicstateHIDDEN); + break; + + case OPT_fgnu_intrinsics_disable: + ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDISABLED); + break; + + case OPT_fgnu_intrinsics_enable: + ffe_set_intrinsic_state_gnu (FFE_intrinsicstateENABLED); + break; + + case OPT_ff2c_intrinsics_delete: + ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDELETED); + break; + + case OPT_ff2c_intrinsics_hide: + ffe_set_intrinsic_state_f2c (FFE_intrinsicstateHIDDEN); + break; + + case OPT_ff2c_intrinsics_disable: + ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDISABLED); + break; + + case OPT_ff2c_intrinsics_enable: + ffe_set_intrinsic_state_f2c (FFE_intrinsicstateENABLED); + break; + + case OPT_ff90_intrinsics_delete: + ffe_set_intrinsic_state_f90 (FFE_intrinsicstateDELETED); + break; + + case OPT_ff90_intrinsics_hide: + ffe_set_intrinsic_state_f90 (FFE_intrinsicstateHIDDEN); + break; + + case OPT_ff90_intrinsics_disable: + ffe_set_intrinsic_state_f90 (FFE_intrinsicstateDISABLED); + break; + + case OPT_ff90_intrinsics_enable: + ffe_set_intrinsic_state_f90 (FFE_intrinsicstateENABLED); + break; + + case OPT_fmil_intrinsics_delete: + ffe_set_intrinsic_state_mil (FFE_intrinsicstateDELETED); + break; + + case OPT_fmil_intrinsics_hide: + ffe_set_intrinsic_state_mil (FFE_intrinsicstateHIDDEN); + break; + + case OPT_fmil_intrinsics_disable: + ffe_set_intrinsic_state_mil (FFE_intrinsicstateDISABLED); + break; + + case OPT_fmil_intrinsics_enable: + ffe_set_intrinsic_state_mil (FFE_intrinsicstateENABLED); + break; + + case OPT_funix_intrinsics_delete: + ffe_set_intrinsic_state_unix (FFE_intrinsicstateDELETED); + break; + + case OPT_funix_intrinsics_hide: + ffe_set_intrinsic_state_unix (FFE_intrinsicstateHIDDEN); + break; + + case OPT_funix_intrinsics_disable: + ffe_set_intrinsic_state_unix (FFE_intrinsicstateDISABLED); + break; + + case OPT_funix_intrinsics_enable: + ffe_set_intrinsic_state_unix (FFE_intrinsicstateENABLED); + break; + + case OPT_fvxt_intrinsics_delete: + ffe_set_intrinsic_state_vxt (FFE_intrinsicstateDELETED); + break; + + case OPT_fvxt_intrinsics_hide: + ffe_set_intrinsic_state_vxt (FFE_intrinsicstateHIDDEN); + break; + + case OPT_fvxt_intrinsics_disable: + ffe_set_intrinsic_state_vxt (FFE_intrinsicstateDISABLED); + break; + + case OPT_fvxt_intrinsics_enable: + ffe_set_intrinsic_state_vxt (FFE_intrinsicstateENABLED); + break; + + case OPT_ffixed_line_length_: + if (strcmp (arg, "none") == 0) { - ffe_set_case_intrin (FFE_caseNONE); - ffe_set_case_match (FFE_caseNONE); - ffe_set_case_source (FFE_caseNONE); - ffe_set_case_symbol (FFE_caseNONE); + ffe_set_fixed_line_length (0); + return -1; } - else if (strcmp (&opt[2], "badu77-intrinsics-delete") == 0) - ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateDELETED); - else if (strcmp (&opt[2], "badu77-intrinsics-hide") == 0) - ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateHIDDEN); - else if (strcmp (&opt[2], "badu77-intrinsics-disable") == 0) - ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateDISABLED); - else if (strcmp (&opt[2], "badu77-intrinsics-enable") == 0) - ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateENABLED); - else if (strcmp (&opt[2], "gnu-intrinsics-delete") == 0) - ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDELETED); - else if (strcmp (&opt[2], "gnu-intrinsics-hide") == 0) - ffe_set_intrinsic_state_gnu (FFE_intrinsicstateHIDDEN); - else if (strcmp (&opt[2], "gnu-intrinsics-disable") == 0) - ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDISABLED); - else if (strcmp (&opt[2], "gnu-intrinsics-enable") == 0) - ffe_set_intrinsic_state_gnu (FFE_intrinsicstateENABLED); - else if (strcmp (&opt[2], "f2c-intrinsics-delete") == 0) - ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDELETED); - else if (strcmp (&opt[2], "f2c-intrinsics-hide") == 0) - ffe_set_intrinsic_state_f2c (FFE_intrinsicstateHIDDEN); - else if (strcmp (&opt[2], "f2c-intrinsics-disable") == 0) - ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDISABLED); - else if (strcmp (&opt[2], "f2c-intrinsics-enable") == 0) - ffe_set_intrinsic_state_f2c (FFE_intrinsicstateENABLED); - else if (strcmp (&opt[2], "f90-intrinsics-delete") == 0) - ffe_set_intrinsic_state_f90 (FFE_intrinsicstateDELETED); - else if (strcmp (&opt[2], "f90-intrinsics-hide") == 0) - ffe_set_intrinsic_state_f90 (FFE_intrinsicstateHIDDEN); - else if (strcmp (&opt[2], "f90-intrinsics-disable") == 0) - ffe_set_intrinsic_state_f90 (FFE_intrinsicstateDISABLED); - else if (strcmp (&opt[2], "f90-intrinsics-enable") == 0) - ffe_set_intrinsic_state_f90 (FFE_intrinsicstateENABLED); - else if (strcmp (&opt[2], "mil-intrinsics-delete") == 0) - ffe_set_intrinsic_state_mil (FFE_intrinsicstateDELETED); - else if (strcmp (&opt[2], "mil-intrinsics-hide") == 0) - ffe_set_intrinsic_state_mil (FFE_intrinsicstateHIDDEN); - else if (strcmp (&opt[2], "mil-intrinsics-disable") == 0) - ffe_set_intrinsic_state_mil (FFE_intrinsicstateDISABLED); - else if (strcmp (&opt[2], "mil-intrinsics-enable") == 0) - ffe_set_intrinsic_state_mil (FFE_intrinsicstateENABLED); - else if (strcmp (&opt[2], "unix-intrinsics-delete") == 0) - ffe_set_intrinsic_state_unix (FFE_intrinsicstateDELETED); - else if (strcmp (&opt[2], "unix-intrinsics-hide") == 0) - ffe_set_intrinsic_state_unix (FFE_intrinsicstateHIDDEN); - else if (strcmp (&opt[2], "unix-intrinsics-disable") == 0) - ffe_set_intrinsic_state_unix (FFE_intrinsicstateDISABLED); - else if (strcmp (&opt[2], "unix-intrinsics-enable") == 0) - ffe_set_intrinsic_state_unix (FFE_intrinsicstateENABLED); - else if (strcmp (&opt[2], "vxt-intrinsics-delete") == 0) - ffe_set_intrinsic_state_vxt (FFE_intrinsicstateDELETED); - else if (strcmp (&opt[2], "vxt-intrinsics-hide") == 0) - ffe_set_intrinsic_state_vxt (FFE_intrinsicstateHIDDEN); - else if (strcmp (&opt[2], "vxt-intrinsics-disable") == 0) - ffe_set_intrinsic_state_vxt (FFE_intrinsicstateDISABLED); - else if (strcmp (&opt[2], "vxt-intrinsics-enable") == 0) - ffe_set_intrinsic_state_vxt (FFE_intrinsicstateENABLED); - else if (strncmp (&opt[2], "fixed-line-length-", - strlen ("fixed-line-length-")) == 0) + else if (ffe_is_digit_string_ (arg)) { - char *len = &opt[2] + strlen ("fixed-line-length-"); - - if (strcmp (len, "none") == 0) - { - ffe_set_fixed_line_length (0); - return -1; - } - else if (ffe_is_digit_string_ (len)) - { - ffe_set_fixed_line_length (atol (len)); - return -1; - } - else - return 0; + ffe_set_fixed_line_length (atol (arg)); + return -1; } - else - return 0; - } - else if (opt[1] == 'W') - { - if (!strcmp (&opt[2], "comment")) - ; /* cpp handles this one. */ - else if (!strcmp (&opt[2], "no-comment")) - ; /* cpp handles this one. */ - else if (!strcmp (&opt[2], "comments")) - ; /* cpp handles this one. */ - else if (!strcmp (&opt[2], "no-comments")) - ; /* cpp handles this one. */ - else if (!strcmp (&opt[2], "trigraphs")) - ; /* cpp handles this one. */ - else if (!strcmp (&opt[2], "no-trigraphs")) - ; /* cpp handles this one. */ - else if (!strcmp (&opt[2], "import")) - ; /* cpp handles this one. */ - else if (!strcmp (&opt[2], "no-import")) - ; /* cpp handles this one. */ - else if (!strcmp (&opt[2], "globals")) - ffe_set_is_warn_globals (TRUE); - else if (!strcmp (&opt[2], "no-globals")) - ffe_set_is_warn_globals (FALSE); - else if (!strcmp (&opt[2], "implicit")) - ffe_set_is_warn_implicit (TRUE); - else if (!strcmp (&opt[2], "no-implicit")) - ffe_set_is_warn_implicit (FALSE); - else if (!strcmp (&opt[2], "surprising")) - ffe_set_is_warn_surprising (TRUE); - else if (!strcmp (&opt[2], "no-surprising")) - ffe_set_is_warn_surprising (FALSE); - else if (!strcmp (&opt[2], "all")) + return 0; + + case OPT_Wcomment: + case OPT_Wcomments: + case OPT_Wimport: + case OPT_Wtrigraphs: + /* These are for cpp. */ + break; + + case OPT_Wglobals: + ffe_set_is_warn_globals (value); + break; + + case OPT_Wimplicit: + ffe_set_is_warn_implicit (value); + break; + + case OPT_Wsurprising: + ffe_set_is_warn_surprising (value); + break; + + case OPT_Wall: + set_Wunused (value); + /* We save the value of warn_uninitialized, since if they put + -Wuninitialized on the command line, we need to generate a + warning about not using it without also specifying -O. */ + if (value) { - /* We save the value of warn_uninitialized, since if they put - -Wuninitialized on the command line, we need to generate a - warning about not using it without also specifying -O. */ if (warn_uninitialized != 1) warn_uninitialized = 2; - set_Wunused (1); } else - return 0; + warn_uninitialized = 0; + break; + + case OPT_I: + ffecom_decode_include_option (arg); + break; } - else if (opt[1] == 'I') - return ffecom_decode_include_option (&opt[2]); - else - return 0; return 1; } diff --git a/gcc/f/top.h b/gcc/f/top.h index 3159b51..60c0995 100644 --- a/gcc/f/top.h +++ b/gcc/f/top.h @@ -141,7 +141,7 @@ extern bool ffe_in_4; /* Declare functions with prototypes. */ -int ffe_decode_option (int argc, char **argv); +int ffe_handle_option (size_t code, const char *arg, int on); void ffe_file (ffewhereFile wf, FILE *f); void ffe_init_0 (void); void ffe_init_1 (void); |