gfortran.h: Add flag_backslash compile-time option.

* 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.

From-SVN: r101216
This commit is contained in:
François-Xavier Coudert 2005-06-20 20:14:20 +00:00
parent e0757dda66
commit 131c66cd15
10 changed files with 58 additions and 8 deletions

View file

@ -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

View file

@ -1421,6 +1421,7 @@ typedef struct
int flag_pack_derived;
int flag_repack_arrays;
int flag_f2c;
int flag_backslash;
int q_kind;

View file

@ -503,10 +503,6 @@ module storage either on stack or heap.
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).

View file

@ -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}

View file

@ -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.

View file

@ -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;

View file

@ -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;

View file

@ -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>

View file

@ -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

View file

@ -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