This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] Add new -std=legacy command line option
- From: Janne Blomqvist <jblomqvi at cc dot hut dot fi>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, Paul Brook <paul at codesourcery dot com>, Steven Bosscher <stevenb at suse dot de>, Tobias Schluter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Date: Sat, 28 May 2005 23:18:50 +0300
- Subject: Re: [gfortran] Add new -std=legacy command line option
- References: <200505281834.43629.paul@codesourcery.com> <Pine.LNX.4.44.0505281341220.8116-100000@www.eyesopen.com>
On Sat, May 28, 2005 at 01:59:22PM -0600, Roger Sayle wrote:
>
> The following patch refines the semantics of gfortran's extensions
> into two categories; GFC_STD_GNU for useful functionality not defined
> in any official fortran standard (i.e. stuff we're proud of) and
> GFC_STD_LEGACY for functionality we're forced to support for backward
> compatibility with other compilers and crusty dusty-deck fortran
> (i.e. the stuff we're embarassed by).
>
> Making this distiction allows us to fine-tune the default behaviour
> of gfortran, to accept both kinds of extensions but to warn about
> the latter. This is the behaviour of -std=gnu. As an enhancement
> to shut up these warnings, I've also added -std=legacy which makes
> a best effort to compile whatever it can without warnings. I've
> also allowed -pedantic to pretty much undo -std=legacy warning wise,
> and effectively "-std=legacy -pedantic" is equivalent to "-std=gnu".
I like the general idea. Perhaps I would personally have chosen
GFC_STD_DUSTY, but I guess _LEGACY is just as good and working code
beats talk any day. ;-)
> Although there are no users of this infrastructure yet, it should
> resolve the LOGICAL <-> INTEGER conversion issue to everyone's
> staisfaction and allow extensions such as using real numbers to
> index arrays, or omitting commas to reclassified as GFC_STD_LEGACY.
> These are really things that warning about, and writers of new code
> should be exposed to these warnings even without specifying
> -pedantic or -std=f95.
I think stuff like Hollerith would be well suited for GFC_STD_LEGACY
as well (wasn't there a patch to add Hollerith support a few days
ago?).
> Ok for mainline?
I'll see if I have time to regtest the patch tomorrow, but on the
surface it looks good, and as I said, I like the general idea.
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/fortran/options.c,v
> retrieving revision 1.19
> diff -c -3 -p -r1.19 options.c
> *** options.c 10 May 2005 22:06:43 -0000 1.19
> --- options.c 28 May 2005 18:36:06 -0000
[snip]
> *************** gfc_post_options (const char **pfilename
> *** 113,118 ****
> --- 114,122 ----
> /* If -pedantic, warn about the use of GNU extensions. */
> if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
> gfc_option.warn_std |= GFC_STD_GNU;
> + /* -std=legacy -pendantic is effectively -std=gnu. */
1
Typo at (1).
--
Janne Blomqvist