From a88a266ccad495e5bb45d510076eea36fe3feaa1 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Fri, 8 Jun 2007 04:49:23 +0000 Subject: re PR fortran/32223 (Backslash handling inconsistent) 2007-06-07 Steven G. Kargl Jerry DeLisle PR fortran/32223 * match.c (gfc_match_special_char): New function. Match special char. Add handling '\0'. * match.h: Add prototype. * io.c (next_char): Use it. * primary.c (next_string_char): Ditto. Co-Authored-By: Jerry DeLisle From-SVN: r125557 --- gcc/fortran/io.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) (limited to 'gcc/fortran/io.c') diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 8e81d6a..4d12b24 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -141,40 +141,17 @@ next_char (int in_string) if (gfc_option.flag_backslash && c == '\\') { + int tmp; locus old_locus = gfc_current_locus; - switch (gfc_next_char_literal (1)) - { - case 'a': - c = '\a'; - break; - case 'b': - c = '\b'; - break; - case 't': - c = '\t'; - break; - case 'f': - c = '\f'; - break; - case 'n': - c = '\n'; - break; - case 'r': - c = '\r'; - break; - case 'v': - c = '\v'; - break; - case '\\': - c = '\\'; - break; + /* Use a temp variable to avoid side effects from gfc_match_special_char + since it uses an int * for its argument. */ + tmp = (int)c; - default: - /* Unknown backslash codes are simply not expanded. */ - gfc_current_locus = old_locus; - break; - } + if (gfc_match_special_char (&tmp) == MATCH_NO) + gfc_current_locus = old_locus; + + c = (char)tmp; if (!(gfc_option.allow_std & GFC_STD_GNU) && !inhibit_warnings) gfc_warning ("Extension: backslash character at %C"); -- cgit v1.1