[Bug fortran/58001] Make it possible to silence "Extension: Tab character in format" warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #16 from kargl at gcc dot gnu.org --- Author: kargl Date: Tue Nov 22 18:25:55 2016 New Revision: 242717 URL: https://gcc.gnu.org/viewcvs?rev=242717=gcc=rev Log: 2016-11-22 Steven G. KarglPR fortran/58001 * io.c (next_char_not_space): Update handling of a 'tab' in a FORMAT. (format_lex): Adjust invocations of next_char_not_space(). 2016-11-22 Steven G. Kargl PR fortran/58001 * gfortran.dg/fmt_tab_1.f90: Adjust testcase. * gfortran.dg/fmt_tab_2.f90: Ditto. Modified: branches/gcc-6-branch/gcc/fortran/ChangeLog branches/gcc-6-branch/gcc/fortran/io.c branches/gcc-6-branch/gcc/testsuite/ChangeLog branches/gcc-6-branch/gcc/testsuite/gfortran.dg/fmt_tab_1.f90 branches/gcc-6-branch/gcc/testsuite/gfortran.dg/fmt_tab_2.f90
[Bug fortran/58001] Make it possible to silence "Extension: Tab character in format" warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 kargl at gcc dot gnu.org changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |kargl at gcc dot gnu.org Target Milestone|--- |7.0 --- Comment #15 from kargl at gcc dot gnu.org --- Fixed on trunk.
[Bug fortran/58001] Make it possible to silence "Extension: Tab character in format" warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #14 from kargl at gcc dot gnu.org --- Author: kargl Date: Thu Nov 17 00:18:18 2016 New Revision: 242530 URL: https://gcc.gnu.org/viewcvs?rev=242530=gcc=rev Log: 2016-11-16 Steven G. KarglPR fortran/58001 * io.c (next_char_not_space): Update handling of a 'tab' in a FORMAT. (format_lex): Adjust invocations of next_char_not_space(). 2016-11-16 Steven G. Kargl PR fortran/58001 * gfortran.dg/fmt_tab_1.f90: Adjust testcase. * gfortran.dg/fmt_tab_2.f90: Ditto. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/io.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/fmt_tab_1.f90 trunk/gcc/testsuite/gfortran.dg/fmt_tab_2.f90
[Bug fortran/58001] Make it possible to silence "Extension: Tab character in format" warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 kargl at gcc dot gnu.org changed: What|Removed |Added CC||kargl at gcc dot gnu.org --- Comment #13 from kargl at gcc dot gnu.org --- (In reply to Dominique d'Humieres from comment #11) > > What happened with patch in comment 9? > > PING! I've posted an updated patch that includes Manuel's comment #12.
[Bug fortran/58001] Make it possible to silence "Extension: Tab character in format" warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 Manuel López-Ibáñez changed: What|Removed |Added CC||manu at gcc dot gnu.org --- Comment #12 from Manuel López-Ibáñez --- (In reply to Steve Kargl from comment #9) > + if (!gfc_option.warn_tabs && c == '\t') > + gfc_warning ("Nonconforming tab character in FORMAT at %C"); > } Nowadays, this would be: if (c == '\t') gfc_warning (OPT_Wtabs, Nonconforming tab character in FORMAT at %C"); Cheers, Manuel.
[Bug fortran/58001] Make it possible to silence "Extension: Tab character in format" warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 Dominique d'Humieres changed: What|Removed |Added CC||kargl at gcc dot gnu.org --- Comment #11 from Dominique d'Humieres --- > What happened with patch in comment 9? PING!
[Bug fortran/58001] Make it possible to silence "Extension: Tab character in format" warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 Dominique d'Humieres changed: What|Removed |Added Status|NEW |WAITING --- Comment #10 from Dominique d'Humieres --- What happened with patch in comment 9?
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #9 from Steve Kargl sgk at troutmask dot apl.washington.edu --- The following patch causes gfortran to treat a tab within a FORMAT statement that same as it does elsewhere for the appearance of a nonconforming use of tab. The two tet cases have been adjusted. Index: gcc/fortran/io.c === --- gcc/fortran/io.c(revision 201382) +++ gcc/fortran/io.c(working copy) @@ -192,23 +192,14 @@ unget_char (void) /* Eat up the spaces and return a character. */ static char -next_char_not_space (bool *error) +next_char_not_space () { char c; do { error_element = c = next_char (NONSTRING); - if (c == '\t') -{ - if (gfc_option.allow_std GFC_STD_GNU) -gfc_warning (Extension: Tab character in format at %C); - else -{ - gfc_error (Extension: Tab character in format at %C); - *error = true; - return c; -} -} + if (!gfc_option.warn_tabs c == '\t') + gfc_warning (Nonconforming tab character in FORMAT at %C); } while (gfc_is_whitespace (c)); return c; @@ -226,7 +217,6 @@ format_lex (void) char c, delim; int zflag; int negative_flag; - bool error = false; if (saved_token != FMT_NONE) { @@ -235,7 +225,7 @@ format_lex (void) return token; } - c = next_char_not_space (error); + c = next_char_not_space (); negative_flag = 0; switch (c) @@ -245,7 +235,7 @@ format_lex (void) /* Falls through. */ case '+': - c = next_char_not_space (error); + c = next_char_not_space (); if (!ISDIGIT (c)) { token = FMT_UNKNOWN; @@ -256,7 +246,7 @@ format_lex (void) do { - c = next_char_not_space (error); + c = next_char_not_space (); if (ISDIGIT (c)) value = 10 * value + c - '0'; } @@ -286,7 +276,7 @@ format_lex (void) do { - c = next_char_not_space (error); + c = next_char_not_space (); if (ISDIGIT (c)) { value = 10 * value + c - '0'; @@ -321,7 +311,7 @@ format_lex (void) break; case 'T': - c = next_char_not_space (error); + c = next_char_not_space (); switch (c) { case 'L': @@ -349,7 +339,7 @@ format_lex (void) break; case 'S': - c = next_char_not_space (error); + c = next_char_not_space (); if (c != 'P' c != 'S') unget_char (); @@ -357,7 +347,7 @@ format_lex (void) break; case 'B': - c = next_char_not_space (error); + c = next_char_not_space (); if (c == 'N' || c == 'Z') token = FMT_BLANK; else @@ -419,7 +409,7 @@ format_lex (void) break; case 'E': - c = next_char_not_space (error); + c = next_char_not_space (); if (c == 'N' ) token = FMT_EN; else if (c == 'S') @@ -449,7 +439,7 @@ format_lex (void) break; case 'D': - c = next_char_not_space (error); + c = next_char_not_space (); if (c == 'P') { if (!gfc_notify_std (GFC_STD_F2003, DP format @@ -472,7 +462,7 @@ format_lex (void) break; case 'R': - c = next_char_not_space (error); + c = next_char_not_space (); switch (c) { case 'C': @@ -513,9 +503,6 @@ format_lex (void) break; } - if (error) -return FMT_ERROR; - return token; } Index: gcc/testsuite/gfortran.dg/fmt_tab_1.f90 === --- gcc/testsuite/gfortran.dg/fmt_tab_1.f90(revision 201382) +++ gcc/testsuite/gfortran.dg/fmt_tab_1.f90(working copy) @@ -1,6 +1,9 @@ -! { dg-do run } +! { dg-do compile } +! { dg-options -Wtabs } ! PR fortran/32987 program TestFormat write (*, 10) - 10 format ('Hello ','bug!') ! { dg-warning Extension: Tab character in format } +! There is a tab character before 'bug'. This is accepted without +! the -Wno-tabs option or a -std= option. + 10 format ('Hello ','bug!') end Index: gcc/testsuite/gfortran.dg/fmt_tab_2.f90 === --- gcc/testsuite/gfortran.dg/fmt_tab_2.f90(revision 201382) +++ gcc/testsuite/gfortran.dg/fmt_tab_2.f90(working copy) @@ -2,6 +2,6 @@ ! { dg-options -std=f2003 } ! PR fortran/32987 program TestFormat -write (*, 10) ! { dg-error FORMAT label 10 at .1. not defined } - 10 format ('Hello ','bug!') ! { dg-error Extension: Tab character in format } +write (*, 10) + 10 format ('Hello ','bug!') ! { dg-warning tab character in FORMAT } end
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 Dominique d'Humieres dominiq at lps dot ens.fr changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2013-07-30 Ever confirmed|0 |1 --- Comment #2 from Dominique d'Humieres dominiq at lps dot ens.fr --- Compiling the following code with -Wtabs print *, AstringwithTabsinsteadofspaces print 1894 1894 format('123') end gives pr58001.f90:3.14: 1894 format( '123') 1 Warning: Extension: Tab character in format at (1) If compiled with -Wno-tabs, it gives pr58001.f90:2.1: print 1894 1 Warning: Nonconforming tab character at (1) pr58001.f90:3.14: 1894 format( '123') 1 Warning: Nonconforming tab character at (1) pr58001.f90:3.14: 1894 format( '123') 1 Warning: Extension: Tab character in format at (1) Is this the expected behavior?-(I was expecting the later output for -Wtabs, and no warning with -Wno-tabs: on most options Wno-* suppress the warnings for the corresponding option.)
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #3 from Steve Kargl sgk at troutmask dot apl.washington.edu --- On Tue, Jul 30, 2013 at 12:59:00PM +, dominiq at lps dot ens.fr wrote: print *, AstringwithTabsinsteadofspaces print 1894 1894 format('123') end According to both vi and nedit, there are no tabs in the above code. I assume that this is cut-n-paste from an xterm term.
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #4 from Dominique d'Humieres dominiq at lps dot ens.fr --- According to both vi and nedit, there are no tabs in the above code. I assume that this is cut-n-paste from an xterm term. With Safari I see the tabs in comment #2, but not in what has been pasted in comment #3. I am attaching the code.
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #5 from Dominique d'Humieres dominiq at lps dot ens.fr --- Created attachment 30573 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30573action=edit test case with tabs
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #6 from Steve Kargl sgk at troutmask dot apl.washington.edu --- On Tue, Jul 30, 2013 at 12:59:00PM +, dominiq at lps dot ens.fr wrote: If compiled with -Wno-tabs, it gives pr58001.f90:2.1: print 1894 1 Warning: Nonconforming tab character at (1) pr58001.f90:3.14: 1894 format( '123') 1 Warning: Nonconforming tab character at (1) pr58001.f90:3.14: 1894 format( '123') 1 Warning: Extension: Tab character in format at (1) Is this the expected behavior? With -Wno-tabs, gfortran should report a warning for the occurence of every tab used in the context of a character from the Fortran character set. Taking your code, which I've deleted here, and replace all whitespace by tabs, I get the expected number of warnings. Historically, I wanted to use -Wtabs as you expected, but there was too much wailing on the gfortran lists, so it was changed to -Wno-tabs with the meaning that no tabs are allowed in the context of the Fortran character set. You'll notice that tabs within a literal character string are not flagged. The history of -Wtabs verse -Wno-tabs can be found in the mailinglist archive. Now, for the problem at hand, it seems that there is a bug in io.c. Here the code in question: /* Eat up the spaces and return a character. */ static char next_char_not_space (bool *error) { char c; do { error_element = c = next_char (NONSTRING); if (c == '\t') { if (gfc_option.allow_std GFC_STD_GNU) gfc_warning (Extension: Tab character in format at %C); else { gfc_error (Extension: Tab character in format at %C); *error = true; return c; } } } while (gfc_is_whitespace (c)); return c; } Notice that there is no check for gfc_option.warn_tabs.
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #7 from Dominique d'Humieres dominiq at lps dot ens.fr --- With -Wno-tabs, gfortran should report a warning for the occurence of every tab used in the context of a character from the Fortran character set. Taking your code, which I've deleted here, and replace all whitespace by tabs, I get the expected number of warnings. Historically, I wanted to use -Wtabs as you expected, but there was too much wailing on the gfortran lists, so it was changed to -Wno-tabs with the meaning that no tabs are allowed in the context of the Fortran character set. You'll notice that tabs within a literal character string are not flagged. I cannot understand the rationale of this choice, but I guess it's too late to change it!-( The history of -Wtabs verse -Wno-tabs can be found in the mailinglist archive. No interest to dig the archives on this issue.
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #8 from Steve Kargl sgk at troutmask dot apl.washington.edu --- On Tue, Jul 30, 2013 at 06:16:27PM +, dominiq at lps dot ens.fr wrote: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 --- Comment #7 from Dominique d'Humieres dominiq at lps dot ens.fr --- With -Wno-tabs, gfortran should report a warning for the occurence of every tab used in the context of a character from the Fortran character set. Taking your code, which I've deleted here, and replace all whitespace by tabs, I get the expected number of warnings. Historically, I wanted to use -Wtabs as you expected, but there was too much wailing on the gfortran lists, so it was changed to -Wno-tabs with the meaning that no tabs are allowed in the context of the Fortran character set. You'll notice that tabs within a literal character string are not flagged. I cannot understand the rationale of this choice, but I guess it's too late to change it!-( The history of -Wtabs verse -Wno-tabs can be found in the mailinglist archive. No interest to dig the archives on this issue. http://gcc.gnu.org/ml/fortran/2006-03/msg00226.html
[Bug fortran/58001] Make it possible to silence Extension: Tab character in format warning
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58001 kargl at gcc dot gnu.org changed: What|Removed |Added CC||kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Tobias Burnus from comment #0) For indenting the source code, gfortran warns only with -std=f* or with -Wtab. Please, check the archive. At one time gfortran would issue a warning if a tab was used in a nonconforming context. Too many people were upset about this, so the -W[no-]tab option, which has a convoluted history, was the compromise. However, for format strings, it always warns - and with -std=f* it even turns the warning into an error! (see io.c's next_char_not_space) Example: 1894 format( '123') end (The tab is before '123'. A tab in the string itself is not warned for.) Maybe the best would be to disable this warning with -std=legacy - and refer to -std=legacy in the -std=gnu warning? Tab is not and never has been a member of the Fortran character set. The above line of code is nonconforming. Gfortran, IMNSHO, should always issue an error, but I lost that battle years ago.