Commit 1355d8e7 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/30968 ([4.1 only] Bogus warning with continued lines of concatenated strings)

2007-02-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/30968
	* primary.c (next_string_char): Correct reading a character
	after the delimiter.
	(match_string_constant): Print warning message only once.

2007-02-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/30968
	* gfortran.dg/continuation_7.f90: New test.

From-SVN: r122401
parent d5b7e972
2007-02-28 Tobias Burnus <burnus@net-b.de>
PR fortran/30968
* primary.c (next_string_char): Correct reading a character
after the delimiter.
(match_string_constant): Print warning message only once.
2007-02-27 Richard Guenther <rguenther@suse.de> 2007-02-27 Richard Guenther <rguenther@suse.de>
* trans-array.c (structure_alloc_comps): Use correct type * trans-array.c (structure_alloc_comps): Use correct type
......
...@@ -773,7 +773,7 @@ next_string_char (char delimiter) ...@@ -773,7 +773,7 @@ next_string_char (char delimiter)
return c; return c;
old_locus = gfc_current_locus; old_locus = gfc_current_locus;
c = gfc_next_char_literal (1); c = gfc_next_char_literal (0);
if (c == delimiter) if (c == delimiter)
return c; return c;
...@@ -852,7 +852,7 @@ static match ...@@ -852,7 +852,7 @@ static match
match_string_constant (gfc_expr **result) match_string_constant (gfc_expr **result)
{ {
char *p, name[GFC_MAX_SYMBOL_LEN + 1]; char *p, name[GFC_MAX_SYMBOL_LEN + 1];
int i, c, kind, length, delimiter; int i, c, kind, length, delimiter, warn_ampersand;
locus old_locus, start_locus; locus old_locus, start_locus;
gfc_symbol *sym; gfc_symbol *sym;
gfc_expr *e; gfc_expr *e;
...@@ -979,10 +979,16 @@ got_delim: ...@@ -979,10 +979,16 @@ got_delim:
gfc_current_locus = start_locus; gfc_current_locus = start_locus;
gfc_next_char (); /* Skip delimiter */ gfc_next_char (); /* Skip delimiter */
/* We disable the warning for the following loop as the warning has already
been printed in the loop above. */
warn_ampersand = gfc_option.warn_ampersand;
gfc_option.warn_ampersand = 0;
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
*p++ = next_string_char (delimiter); *p++ = next_string_char (delimiter);
*p = '\0'; /* TODO: C-style string is for development/debug purposes. */ *p = '\0'; /* TODO: C-style string is for development/debug purposes. */
gfc_option.warn_ampersand = warn_ampersand;
if (next_string_char (delimiter) != -1) if (next_string_char (delimiter) != -1)
gfc_internal_error ("match_string_constant(): Delimiter not found"); gfc_internal_error ("match_string_constant(): Delimiter not found");
......
2007-02-28 Tobias Burnus <burnus@net-b.de>
PR fortran/30968
* gfortran.dg/continuation_7.f90: New test.
2007-02-28 Bernd Schmidt <bernd.schmidt@analog.com> 2007-02-28 Bernd Schmidt <bernd.schmidt@analog.com>
* g++.dg/inherit/thunk7.C: New test. * g++.dg/inherit/thunk7.C: New test.
! { dg-do "compile" }
! { dg-options "-Wall -std=f95" }
! There should only two warnings be printed.
! PR fortran/30968
print *, "Foo bar&
&Bar foo"
print *, "Foo bar&
Bar foo" ! { dg-warning "Missing '&' in continued character constant" }
print *, "Foo bar"&
&, "Bar foo"
print *, "Foo bar"&
, "Bar foo"
print '(&
a)', 'Hello' ! { dg-warning "Missing '&' in continued character constant" }
print '(&
&a)', 'Hello'
print '('&
&//'a)', 'Hello'
print '('&
// "a)", 'Hello'
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment