From e7fbac943eefc8992b9e24513f9b5394d40678ca Mon Sep 17 00:00:00 2001 From: jvdelisle Date: Sun, 13 Mar 2016 00:19:08 +0000 Subject: [PATCH] 2016-03-12 Jerry DeLisle Harold Anlauf PR fortran/69520 * invoke.texi: Explain use of the 'no-' construct within the -fcheck= option. * options.c (gfc_handle_runtime_check_option): Enable use of 'no-' prefix for the various options with -fcheck= to allow negating previously enabled check options. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234167 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 10 ++++++++++ gcc/fortran/invoke.texi | 10 +++++++++- gcc/fortran/options.c | 9 +++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index cf0cb6d..9d3f200 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2016-03-12 Jerry DeLisle + Harold Anlauf + + PR fortran/69520 + * invoke.texi: Explain use of the 'no-' construct within the + -fcheck= option. + * options.c (gfc_handle_runtime_check_option): Enable use of + 'no-' prefix for the various options with -fcheck= to allow + negating previously enabled check options. + 2016-03-12 Paul Thomas PR fortran/70031 diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 7fbbc4b..e90656e 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -1398,7 +1398,8 @@ library needs to be linked. @cindex checking array temporaries Enable the generation of run-time checks; the argument shall be -a comma-delimited list of the following keywords. +a comma-delimited list of the following keywords. Prefixing a check with +@option{no-} disables it if it was activated by a previous specification. @table @asis @item @samp{all} @@ -1444,6 +1445,13 @@ Note: This check does not work for OpenMP programs and is disabled if used together with @option{-frecursive} and @option{-fopenmp}. @end table +Example: Assuming you have a file @file{foo.f90}, the command +@smallexample + gfortran -fcheck=all,no-array-temps foo.f90 +@end smallexample +will compile the file with all checks enabled as specified above except +warnings for generated array temporaries. + @item -fbounds-check @opindex @code{fbounds-check} diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index f8d8f8d..0fcda1d 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -515,6 +515,15 @@ gfc_handle_runtime_check_option (const char *arg) result = 1; break; } + else if (optname[n] && pos > 3 && strncmp ("no-", arg, 3) == 0 + && strncmp (optname[n], arg+3, pos-3) == 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); -- 2.7.4