This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Reversal of -fcheck options?
- From: Harald Anlauf <anlauf at gmx dot de>
- To: fortran at gcc dot gnu dot org
- Date: Tue, 26 Jan 2016 23:24:47 +0100
- Subject: Re: Reversal of -fcheck options?
- Authentication-results: sourceware.org; auth=none
- References: <56A7DFC4 dot 7060209 at gmx dot de>
Hello again,
the trivial patch below enables reversal of checks as in:
gfortran -fcheck=all,nomem ...
etc. If somebody wants to take it, please do so.
Thanks,
Harald
Index: gcc/fortran/options.c
===================================================================
--- gcc/fortran/options.c (revision 232848)
+++ gcc/fortran/options.c (working copy)
@@ -515,6 +515,15 @@
result = 1;
break;
}
+ else if (optname[n] && pos > 2 && strncmp ("no", arg, 2) == 0
+ && strncmp (optname[n], arg+2, pos-2) == 0)
+ {
+ gfc_option.rtcheck &= ~optmask[n];
+ arg += pos;
+ pos = 0;
+ result = 1;
+ break;
+ }
}
if (!result)
gfc_fatal_error ("Argument to %<-fcheck%> is not valid: %s", arg);
On 01/26/16 22:06, Harald Anlauf wrote:
> Hello,
>
> is there a way to revert a -fcheck=... option later in the command line?
>
> The "old-style" variants allow e.g.
>
> gfortran ... -fbounds-check ... -fno-bounds-check ...
>
> but the documentation
>
> https://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html#Code-Gen-Options
>
> does not explain how to do this for -fcheck=bounds etc.
> (-fcheck=nobounds or -fcheck=no-bounds is not accepted).
> So it's probably not supported (yet).
>
> Rationale: I'd like to use this in Makefiles to turn off
> checking options for individual files, e.g. because of PR69385.
>
> Cheers,
> Harald
>