From: burnus Date: Wed, 28 Feb 2007 08:03:47 +0000 (+0000) Subject: 2007-02-28 Tobias Burnus X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c712fdffd788869bfeec04eb12bda137925b43e8;p=thirdparty%2Fgcc.git 2007-02-28 Tobias Burnus 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 PR fortran/30968 * gfortran.dg/continuation_7.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122401 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d4b548db7f20..32bf7e63da58 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2007-02-28 Tobias Burnus + + 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 * trans-array.c (structure_alloc_comps): Use correct type diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 4649b4ca02b0..3044703357ac 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -773,7 +773,7 @@ next_string_char (char delimiter) return c; old_locus = gfc_current_locus; - c = gfc_next_char_literal (1); + c = gfc_next_char_literal (0); if (c == delimiter) return c; @@ -852,7 +852,7 @@ static match match_string_constant (gfc_expr **result) { 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; gfc_symbol *sym; gfc_expr *e; @@ -979,10 +979,16 @@ got_delim: gfc_current_locus = start_locus; 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++) *p++ = next_string_char (delimiter); *p = '\0'; /* TODO: C-style string is for development/debug purposes. */ + gfc_option.warn_ampersand = warn_ampersand; if (next_string_char (delimiter) != -1) gfc_internal_error ("match_string_constant(): Delimiter not found"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8552b1c63a97..1261449aa727 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-02-28 Tobias Burnus + + PR fortran/30968 + * gfortran.dg/continuation_7.f90: New test. + 2007-02-28 Bernd Schmidt * g++.dg/inherit/thunk7.C: New test. diff --git a/gcc/testsuite/gfortran.dg/continuation_7.f90 b/gcc/testsuite/gfortran.dg/continuation_7.f90 new file mode 100644 index 000000000000..0a761889ba99 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/continuation_7.f90 @@ -0,0 +1,22 @@ +! { 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