This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix Fortran SWITCH_TAKES_ARG (Was Re: [C++ PATCH] PR/9394)


Devang Patel <dpatel at apple dot com> writes:

> This fixes PR 9394. Bootstrapped on powerpc-darwin.
> It did not introduce any regression in dejagnu tests.
>
> Benjamin Kosnik helped me to test this on linux. Thanks.
>
> OK for main trunk ?
> OK for 3.3 branch? It is a regression from 3.1.
>
> 2003-03-10  Devang Patel  <dpatel at apple dot com>
>          * gcc.c (DEFAULT_SWITCH_TAKES_ARG): Remove.
>          (DEFAULT_WORD_SWITCH_TAKES_ARG): Remove.
>          * gcc.h (DEFAULT_SWITCH_TAKES_ARG): Add.
>          (DEFAULT_WORD_SWITCH_TAKES_ARG): Add.
>          * cppspec.c (DEFAULT_SWTICH_TAKES_ARG): Remove.
>          (DEFAULT_WORD_SWITCH_TAKES_ARG): Remove.
>
> c++
>          * g++spec.c (lang_specific_driver): Use
>          * DEFAULT_WORD_SWITCH_TAKES_ARG.

This patch introduces these new warnings:

/cvs/gcc/gcc/f/g77spec.c:107:1: warning: "DEFAULT_SWITCH_TAKES_ARG" redefined
/cvs/gcc/gcc/gcc.h:36:1: warning: this is the location of the previous definition
/cvs/gcc/gcc/f/g77spec.c:119:1: warning: "DEFAULT_WORD_SWITCH_TAKES_ARG" redefined
/cvs/gcc/gcc/gcc.h:45:1: warning: this is the location of the previous definition

f/g77spec.c has this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* --- This comes from gcc.c (2.8.1) verbatim: */

/* This defines which switch letters take arguments.  */

#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')

#define DEFAULT_WORD_SWITCH_TAKES_ARG(STR)		\
 (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
  || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
  || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
  || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
  || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
  || !strcmp (STR, "isystem") || !strcmp (STR, "specs"))
[comments ommitted]
/* --- End of verbatim.  */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And gcc.h uses:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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')

/* This defines which multi-letter switches take arguments.  */

#define DEFAULT_WORD_SWITCH_TAKES_ARG(STR)		\
 (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
  || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
  || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
  || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
  || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
  || !strcmp (STR, "isystem") || !strcmp (STR, "-param") \
  || !strcmp (STR, "specs") \
  || !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ"))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

According to the comment in g77spec.c and the usage of the code these
should be the same.  Toon, is this right?

I have bootstrapped/regtested this patch successfully on
i686-linux-gnu.

The same patch is needed on 3.3 also.
Ok to commit for mainline and 3.3?

Andreas

2003-03-13  Andreas Jaeger  <aj at suse dot de>

	* g77spec.c (DEFAULT_SWITCH_TAKES_ARG): Remove.
	(DEFAULT_WORD_SWITCH_TAKES_ARG): Remove.

============================================================
Index: gcc/f/g77spec.c
--- gcc/f/g77spec.c	13 Mar 2003 02:38:00 -0000	1.41
+++ gcc/f/g77spec.c	13 Mar 2003 08:27:59 -0000
@@ -1,5 +1,6 @@
 /* Specific flags and argument handling of the Fortran front-end.
-   Copyright (C) 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -100,35 +101,13 @@ static void append_arg PARAMS ((const ch
 static int g77_newargc;
 static const char **g77_newargv;
 
-/* --- This comes from gcc.c (2.8.1) verbatim: */
-
-/* This defines which switch letters take arguments.  */
-
-#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')
-
 #ifndef SWITCH_TAKES_ARG
 #define SWITCH_TAKES_ARG(CHAR) DEFAULT_SWITCH_TAKES_ARG(CHAR)
 #endif
 
-/* This defines which multi-letter switches take arguments.  */
-
-#define DEFAULT_WORD_SWITCH_TAKES_ARG(STR)		\
- (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
-  || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
-  || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
-  || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
-  || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
-  || !strcmp (STR, "isystem") || !strcmp (STR, "specs"))
-
 #ifndef WORD_SWITCH_TAKES_ARG
 #define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
 #endif
-
-/* --- End of verbatim.  */
 
 /* Assumes text[0] == '-'.  Returns number of argv items that belong to
    (and follow) this one, an option id for options important to the

-- 
 Andreas Jaeger
  SuSE Labs aj at suse dot de
   private aj at arthur dot inka dot de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]