This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, fortran] PR35019 - joined and sparated arguments to options (2nd try)
- From: Daniel Franke <franke dot daniel at gmail dot com>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 28 Mar 2008 11:35:00 +0100
- Subject: [patch, fortran] PR35019 - joined and sparated arguments to options (2nd try)
http://gcc.gnu.org/onlinedocs/gccint/Option-properties.html
Joined
Separate
The option takes a mandatory argument. Joined indicates that the option and
argument can be included in the same argv entry (as with -mflush-func=name,
for example). Separate indicates that the option and argument can be separate
argv entries (as with -o). An option is allowed to have both of these
properties.
Unfortunately, this seems to be part of the truth only. The first patch [1]
added the above properties to I and J in fortran/lang.opt, however, currently
only -I works as expected, the options -J and -fintrinsic-modules-path don't.
The only difference between -I and -J I could find was in gcc.h were a macro
(DEFAULT_SWITCH_TAKES_ARG) lists options that take arguments; -I was listed
there, -J wasn't. Adding -J to the list of options that take arguments fixes
the problem.
Why one needs to list the options in said macro and why this information is
not extracted from the .opt file eludes me.
:ADDPATCH gcc/fortran:
gcc:
2008-03-28 Daniel Franke <franke.daniel@gmail.com>
PR fortran/35019
* gcc.h: Added fortran options that take arguments to
DEFAULT_SWITCH_TAKES_ARG and DEFAULT_WORD_SWITCH_TAKES_ARG macros.
gcc/fortran:
2008-03-28 Daniel Franke <franke.daniel@gmail.com>
PR fortran/35019
* gfortranspec.c (lookup_option): Poperly handle separated arguments
in -J option, print missing argument message when necessary.
Bootstrapped and regression tested on i686-pc-linux-gnu. Ok for trunk?
Regards
Daniel
[1] http://gcc.gnu.org/ml/fortran/2008-02/msg00079.html
Index: gcc.h
===================================================================
--- gcc.h (revision 133396)
+++ gcc.h (working copy)
@@ -35,9 +35,9 @@ struct spec_function
#define DEFAULT_SWITCH_TAKES_ARG(CHAR) \
((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
|| (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
- || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
- || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
- || (CHAR) == 'B' || (CHAR) == 'b')
+ || (CHAR) == 'I' || (CHAR) == 'J' || (CHAR) == 'm' \
+ || (CHAR) == 'x' || (CHAR) == 'L' || (CHAR) == 'A' \
+ || (CHAR) == 'V' || (CHAR) == 'B' || (CHAR) == 'b')
/* This defines which multi-letter switches take arguments. */
@@ -50,7 +50,8 @@ struct spec_function
|| !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
|| !strcmp (STR, "isysroot") \
|| !strcmp (STR, "-param") || !strcmp (STR, "specs") \
- || !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ"))
+ || !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ") \
+ || !strcmp(STR, "fintrinsic-modules-path"))
/* These are exported by gcc.c. */
Index: fortran/gfortranspec.c
===================================================================
--- fortran/gfortranspec.c (revision 133396)
+++ fortran/gfortranspec.c (working copy)
@@ -175,6 +175,8 @@ lookup_option (Option *xopt, int *xskip,
opt = OPTION_v, skip = 0;
else if (text[1] == 'x')
opt = OPTION_x, arg = text + 2;
+ else if (text[1] == 'J')
+ ;
else
{
if ((skip = WORD_SWITCH_TAKES_ARG (text + 1)) != 0) /* See gcc.c. */