diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-20 20:14:20 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-20 20:14:20 +0000 |
commit | 2467f78d24e7e2734a61da6e91a5c1628f71fe01 (patch) | |
tree | 2056e189f5620a845044b4bfa63a30c1e4a686cc /gcc | |
parent | b5d2cfa51835929cd53ac0bf14240f864ce523b9 (diff) | |
download | ppe42-gcc-2467f78d24e7e2734a61da6e91a5c1628f71fe01.tar.gz ppe42-gcc-2467f78d24e7e2734a61da6e91a5c1628f71fe01.zip |
* gfortran.h: Add flag_backslash compile-time option.
* lang.opt: Add support for -fbackslash option.
* options.c: Likewise.
* primary.c: Implement behavior for -fno-backslash.
* invoke.texi: Add doc for -fbackslash option.
* gfortran.texi: Remove mention of -fno-backslash as a
possible extension.
* gfortran.dg/backslash_1.f90: New test.
* gfortran.dg/backslash_2.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101216 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/fortran/gfortran.h | 1 | ||||
-rw-r--r-- | gcc/fortran/gfortran.texi | 4 | ||||
-rw-r--r-- | gcc/fortran/invoke.texi | 9 | ||||
-rw-r--r-- | gcc/fortran/lang.opt | 4 | ||||
-rw-r--r-- | gcc/fortran/options.c | 5 | ||||
-rw-r--r-- | gcc/fortran/primary.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/backslash_1.f90 | 9 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/backslash_2.f90 | 11 |
10 files changed, 58 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index da57e97dfc9..614a23803d9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,4 +1,14 @@ -2005-06-20 Steven G. Kargl <kargls@comcast.net. +2005-06-19 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + * gfortran.h: Add flag_backslash compile-time option. + * lang.opt: Add support for -fbackslash option. + * options.c: Likewise. + * primary.c: Implement behavior for -fno-backslash. + * invoke.texi: Add doc for -fbackslash option. + * gfortran.texi: Remove mention of -fno-backslash as a + possible extension. + +2005-06-20 Steven G. Kargl <kargls@comcast.net> (port from g95) PR fortran/21257 diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 69a56e188ac..085e1ae72e6 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1421,6 +1421,7 @@ typedef struct int flag_pack_derived; int flag_repack_arrays; int flag_f2c; + int flag_backslash; int q_kind; diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 50b64990985..9ac79b884ea 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -504,10 +504,6 @@ Flag to cause the compiler to distinguish between upper and lower case names. The Fortran 95 standard does not distinguish them. @item -Compile switch for changing the interpretation of a backslash from a -character to ``C''-style escape characters. - -@item Compile flag to generate code for array conformance checking (suggest -CC). @item diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index e3d2e26848a..feeacf7e9b6 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -208,6 +208,15 @@ Do nothing if this is already the default. @cindex character set Allow @samp{$} as a valid character in a symbol name. +@cindex -fno-backslash option +@cindex options, -fno-backslash +@item -fno-backslash +@cindex backslash +@cindex escape characters +@item +Compile switch to change the interpretation of a backslash from +``C''-style escape characters to a single backslash character. + @cindex -ffixed-line-length-@var{n} option @cindex options, -ffixed-line-length-@var{n} @item -ffixed-line-length-@var{n} diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 6798b6d4f14..fd92d15ded8 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -85,6 +85,10 @@ fdollar-ok F95 Allow dollar signs in entity names +fbackslash +F95 +Specify that backslash in string introduces an escape character + fdump-parse-tree F95 Display the code tree after parsing. diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 347f7068b96..681dbdacc79 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -70,6 +70,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED, gfc_option.flag_no_backend = 0; gfc_option.flag_pack_derived = 0; gfc_option.flag_repack_arrays = 0; + gfc_option.flag_backslash = 1; gfc_option.q_kind = gfc_default_double_kind; @@ -233,6 +234,10 @@ gfc_handle_option (size_t scode, const char *arg, int value) gfc_option.flag_dollar_ok = value; break; + case OPT_fbackslash: + gfc_option.flag_backslash = value; + break; + case OPT_fdump_parse_tree: gfc_option.verbose = value; break; diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index e1acfbf3621..984adcfa426 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -637,7 +637,7 @@ next_string_char (char delimiter) if (c == '\n') return -2; - if (c == '\\') + if (gfc_option.flag_backslash && c == '\\') { old_locus = gfc_current_locus; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 18935f588c7..088e10aeb4f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-06-19 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + * gfortran.dg/backslash_1.f90: New test. + * gfortran.dg/backslash_2.f90: New test. + 2005-06-20 Steven G. Kargl <kargls@comcast.net> * gfortran.dg/duplicate_labels.f90: New test. @@ -25,8 +30,8 @@ 2005-06-19 Aldy Hernandez <aldyh@redhat.com> - PR c++/22115 - * g++.dg/conversion/simd2.C: Change expected error message. + PR c++/22115 + * g++.dg/conversion/simd2.C: Change expected error message. 2005-06-18 Dorit Nuzman <dorit@il.ibm.com> diff --git a/gcc/testsuite/gfortran.dg/backslash_1.f90 b/gcc/testsuite/gfortran.dg/backslash_1.f90 new file mode 100644 index 00000000000..db7ddbc24b7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/backslash_1.f90 @@ -0,0 +1,9 @@ +! { dg-do run } +! { dg-options "-fno-backslash" } + character(len=4) a + open (10, status='scratch') + write (10,'(A)') '1\n2' + rewind (10) + read (10,'(A)') a + if (a /= '1\n2') call abort + end diff --git a/gcc/testsuite/gfortran.dg/backslash_2.f90 b/gcc/testsuite/gfortran.dg/backslash_2.f90 new file mode 100644 index 00000000000..2f954d53949 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/backslash_2.f90 @@ -0,0 +1,11 @@ +! { dg-do run } +! { dg-options "-fbackslash" } + integer :: i, e + open (10, status='scratch') + write (10,'(A)') '1\n2' + rewind (10) + read (10,*,iostat=e) i + if (e /= 0 .or. i /= 1) call abort + read (10,*,iostat=e) i + if (e /= 0 .or. i /= 2) call abort + end |