aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2015-01-10 16:49:37 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2015-01-10 16:49:37 +0100
commitaecfd035204b7ddf5520279914ee228ca8c704c2 (patch)
tree74cf6d52501de9a6c02c556576cdc6f72d092ed5 /gcc/fortran
parentab018c82134b7eeb7107f16e0ae9591a7cafe1ba (diff)
downloadgcc-aecfd035204b7ddf5520279914ee228ca8c704c2.zip
gcc-aecfd035204b7ddf5520279914ee228ca8c704c2.tar.gz
gcc-aecfd035204b7ddf5520279914ee228ca8c704c2.tar.bz2
re PR fortran/64522 (Free-form source code: -Wline-truncation is no longer enabled by default)
2015-01-10 Tobias Burnus <burnus@net-b.de> PR fortran/64522 * invoke.texi (Wline-truncation): Document new behaviour. * lang.opt (Wline-truncation): Add Init(-1). * options.c (gfc_post_options): If -Wline-truncation is unset, enable it for free-form source files; for the latter, also use -Werror=line-truncation, unless -Wno-error has been specified. 2015-01-10 Tobias Burnus <burnus@net-b.de> PR fortran/64522 * gfortran.dg/line_length_5.f90: Change dg-warning to dg-error and add dg-excess-errors. * gfortran.dg/line_length_6.f90: New. * gfortran.dg/line_length_7.f90: New. * gfortran.dg/line_length_8.f90: New. * gfortran.dg/line_length_9.f90: New. * gfortran.dg/line_length_10.f90: New. * gfortran.dg/line_length_11.f90: New. From-SVN: r219424
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/invoke.texi4
-rw-r--r--gcc/fortran/lang.opt2
-rw-r--r--gcc/fortran/options.c13
4 files changed, 26 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 141bc48..c10a1db 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,12 @@
+2015-01-10 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/64522
+ * invoke.texi (Wline-truncation): Document new behaviour.
+ * lang.opt (Wline-truncation): Add Init(-1).
+ * options.c (gfc_post_options): If -Wline-truncation is unset,
+ enable it for free-form source files; for the latter, also use
+ -Werror=line-truncation, unless -Wno-error has been specified.
+
2015-01-09 Michael Collison <michael.collison@linaro.org>
* convert.c: Include hash-set.h, machmode.h, vec.h, double-int.h,
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 4cf36e8..39bc479 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -790,7 +790,9 @@ Warn when a character assignment will truncate the assigned string.
@opindex @code{Wline-truncation}
@cindex warnings, line truncation
Warn when a source code line will be truncated. This option is
-implied by @option{-Wall}.
+implied by @option{-Wall}. For free-form source code, the default is
+@option{-Werror=line-truncation} such that truncations are reported as
+error.
@item -Wconversion
@opindex @code{Wconversion}
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index c4ebbe7..530ec97 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -250,7 +250,7 @@ Fortran Warning Var(warn_implicit_procedure)
Warn about called procedures not explicitly declared
Wline-truncation
-Fortran Warning Var(warn_line_truncation) LangEnabledBy(Fortran,Wall)
+Fortran Warning Var(warn_line_truncation) LangEnabledBy(Fortran,Wall) Init(-1)
Warn about truncated source lines
Wintrinsics-std
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index a356f53..4bae04e 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -314,7 +314,20 @@ gfc_post_options (const char **pfilename)
"in free form");
else if (gfc_option.flag_d_lines == 1)
gfc_warning_now ("%<-fd-lines-as-code%> has no effect in free form");
+
+ if (warn_line_truncation == -1)
+ warn_line_truncation = 1;
+
+ /* Enable -Werror=line-truncation when -Werror and -Wno-error have
+ not been set. */
+ if (warn_line_truncation && !global_options_set.x_warnings_are_errors
+ && (global_dc->classify_diagnostic[OPT_Wline_truncation] ==
+ DK_UNSPECIFIED))
+ diagnostic_classify_diagnostic (global_dc, OPT_Wline_truncation,
+ DK_ERROR, UNKNOWN_LOCATION);
}
+ else if (warn_line_truncation == -1)
+ warn_line_truncation = 0;
/* If -pedantic, warn about the use of GNU extensions. */
if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)