2013-04-16 Tobias Burnus <burnus@net-b.de>
PR fortran/39505
* gfortran.h (gfc_option_t): Add flag_directives.
* gfortran.texi (GCC Fortran directives): Mention
-fno-directives.
* invoke.texi (-fno-directives): Add.
* lang.opt (fdirectives): Add.
* options.c (gfc_init_options, gfc_handle_option): Handle it.
* scanner.c (skip_gcc_attribute): Ditto.
@@ -2300,6 +2300,7 @@ typedef struct
int flag_realloc_lhs;
int flag_aggressive_function_elimination;
int flag_frontend_optimize;
+ int flag_directives;
int fpe;
int rtcheck;
@@ -2663,6 +2663,9 @@ on the processor; see
@ref{Top,,C Extensions,gcc,Using the GNU Compiler Collection (GCC)}
for details.
+Note that the parsing of the directives can be disabled via the
+@option{-fno-directives} option.
+
For procedures and procedure pointers, the following attributes can
be used to change the calling convention:
@@ -116,7 +116,7 @@ by type. Explanations are in the following sections.
@xref{Fortran Dialect Options,,Options controlling Fortran dialect}.
@gccoptlist{-fall-intrinsics -fbackslash -fcray-pointer -fd-lines-as-code @gol
-fd-lines-as-comments -fdefault-double-8 -fdefault-integer-8 @gol
--fdefault-real-8 -fdollar-ok -ffixed-line-length-@var{n} @gol
+-fdefault-real-8 -fdirectives -fdollar-ok -ffixed-line-length-@var{n} @gol
-ffixed-line-length-none -ffree-form -ffree-line-length-@var{n} @gol
-ffree-line-length-none -fimplicit-none -finteger-4-integer-8 @gol
-fmax-identifier-length -fmodule-private -fno-fixed-form -fno-range-check @gol
@@ -250,6 +250,11 @@ the kind of non-double real constants like @code{1.0}, and does promote
the default width of @code{DOUBLE PRECISION} to 16 bytes if possible, unless
@code{-fdefault-double-8} is given, too.
+@item -fno-directives
+@opindex @code{fdirectives}
+@opindex @code{fno-directives}
+Disable the GNU Fortran Compiler Directives (@code{!GCC$}) directives.
+
@item -fdollar-ok
@opindex @code{fdollar-ok}
@cindex @code{$}
@@ -389,6 +389,10 @@ fdollar-ok
Fortran
Allow dollar signs in entity names
+fdirectives
+Fortran
+Enable !GCC$ directives
+
fdump-core
Fortran Ignore
Does nothing. Preserved for backward compatibility.
@@ -122,6 +122,7 @@ gfc_init_options (unsigned int decoded_options_count,
gfc_option.flag_integer4_kind = 0;
gfc_option.flag_real4_kind = 0;
gfc_option.flag_real8_kind = 0;
+ gfc_option.flag_directives = 1;
gfc_option.flag_dollar_ok = 0;
gfc_option.flag_underscoring = 1;
gfc_option.flag_f2c = 0;
@@ -766,6 +767,10 @@ gfc_handle_option (size_t scode, const char *arg, int value,
gfc_option.flag_d_lines = 0;
break;
+ case OPT_fdirectives:
+ gfc_option.flag_directives = value;
+ break;
+
case OPT_fdump_fortran_original:
case OPT_fdump_parse_tree:
gfc_option.dump_fortran_original = value;
@@ -718,6 +718,9 @@ skip_gcc_attribute (locus start)
char c;
locus old_loc = gfc_current_locus;
+ if (!gfc_option.flag_directives)
+ return false;
+
if ((c = next_char ()) == 'g' || c == 'G')
if ((c = next_char ()) == 'c' || c == 'C')
if ((c = next_char ()) == 'c' || c == 'C')
@@ -770,7 +773,7 @@ skip_free_comments (void)
if (c == '!')
{
/* Keep the !GCC$ line. */
- if (at_bol && skip_gcc_attribute (start))
+ if (at_bol && skip_gcc_attribute (start))
return false;
/* If -fopenmp, we need to handle here 2 things: