From: Fritz Reese Date: Tue, 25 Oct 2016 15:20:36 +0000 (+0000) Subject: Treat form feed as whitespace. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ef14476730875df063a5788a0072984e22b7c2ec;p=gcc.git Treat form feed as whitespace. gcc/fortran/ * gfortran.texi: Document. * gfortran.h (gfc_is_whitespace): Include form feed ('\f'). gcc/testsuite/gfortran.dg/ * feed_1.f90, feed_2.f90: New testcases. From-SVN: r241517 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ab98c202e1c..d3971a63610 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-10-25 Fritz Reese + + * gfortran.texi: Document. + * gfortran.h (gfc_is_whitespace): Include form feed ('\f'). + 2016-10-25 Fritz Reese * invoke.texi, gfortran.texi: Touch up documentation of -fdec. @@ -10,6 +15,7 @@ * lang.opt (fdec): Use Fortran Var to create flag_dec. * options.c (set_dec_flags): With -fdec enable -fcray-pointer, -fd-lines-as-comments (default), -fdollar-ok, and legacy std flags. + 2016-10-24 Jerry DeLisle PR fortran/77828 diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 78a75e58b51..37423b7524a 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -60,7 +60,7 @@ not after. #define MAX_SUBRECORD_LENGTH 2147483639 /* 2**31-9 */ -#define gfc_is_whitespace(c) ((c==' ') || (c=='\t')) +#define gfc_is_whitespace(c) ((c==' ') || (c=='\t') || (c=='\f')) /* Macros to check for groups of structure-like types and flavors since derived types, structures, maps, unions are often treated similarly. */ diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index fa1f17cf54c..688b9565e26 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -1465,6 +1465,7 @@ compatibility extensions along with those enabled by @option{-std=legacy}. * Type variants for integer intrinsics:: * AUTOMATIC and STATIC attributes:: * Extended math intrinsics:: +* Form feed as whitespace:: @end menu @node Old-style kind specifications @@ -2510,6 +2511,16 @@ and then multiplying it by a constant radian-to-degree (or degree-to-radian) factor, as appropriate. The factor is computed at compile-time as 180/pi (or pi/180). +@node Form feed as whitespace +@subsection Form feed as whitespace +@cindex form feed whitespace + +Historically, legacy compilers allowed insertion of form feed characters ('\f', +ASCII 0xC) at the beginning of lines for formatted output to line printers, +though the Fortran standard does not mention this. GNU Fortran supports the +interpretation of form feed characters in source as whitespace for +compatibility. + @node Extensions not implemented in GNU Fortran @section Extensions not implemented in GNU Fortran diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index edc026eb44f..b2662db6008 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-25 Fritz Reese + + gfortran.dg/ + * feed_1.f90, feed_2.f90: New testcases. + 2016-10-25 Martin Liska PR sanitizer/78106 diff --git a/gcc/testsuite/gfortran.dg/feed_1.f90 b/gcc/testsuite/gfortran.dg/feed_1.f90 new file mode 100644 index 00000000000..4dc98a14232 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/feed_1.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-ffree-form" } +! Test acceptance of form feed character in free source. + +implicit none +integer, volatile :: x + + + +x = 5 + +end diff --git a/gcc/testsuite/gfortran.dg/feed_2.f90 b/gcc/testsuite/gfortran.dg/feed_2.f90 new file mode 100644 index 00000000000..c55435f3a9b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/feed_2.f90 @@ -0,0 +1,12 @@ + ! { dg-do compile } + ! { dg-options "-ffixed-form" } + ! Test acceptance of form feed character in fixed source. + + implicit none + integer, volatile :: x + + + + x = 5 + + end