This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran] Diagnose format X as a GNU extension
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org, <fortran at gcc dot gnu dot org>
- Cc: Paul Brook <paul at codesourcery dot com>
- Date: Fri, 21 May 2004 09:57:44 -0600 (MDT)
- Subject: [gfortran] Diagnose format X as a GNU extension
The following patch use gfortran's gfc_notify_std machinery to reflect
that ommitting the number from the X descriptor in format statements is
a GNU extension. I agree completely with Paul that this is the correct
thing to do.
For a two line patch, the only things I'm unhappy about are when
gfc_notify_std returns FAILURE, and what happens in the front-end
after this check_format routine returns FAILURE. I think that
gfc_notify_std shouldn't report a warning if -std=gnu, and I think
the front-end needs to avoid reporting that a format label is
undefined in every statement refering to this format, if we diagnose
a syntax error in it. Both these issues can be fixed independently.
The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all languages including gfortran, and tested with a
top-level "make -k check" with no new failures.
Ok for mainline?
2004-05-21 Roger Sayle <roger@eyesopen.com>
* io.c (check_format): Use gfc_notify_std to determine whether to
issue an error/warning for omitting the digits from the X format.
Index: io.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/io.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 io.c
*** io.c 20 May 2004 18:56:33 -0000 1.4
--- io.c 21 May 2004 03:27:37 -0000
*************** format_item:
*** 473,482 ****
case FMT_X:
/* X requires a prior number if we're being pedantic. */
! if (!pedantic)
! goto between_desc;
! error = "X descriptor requires leading space count";
! goto syntax;
case FMT_SIGN:
case FMT_BLANK:
--- 473,483 ----
case FMT_X:
/* X requires a prior number if we're being pedantic. */
! if (gfc_notify_std (GFC_STD_GNU, "Extension: X descriptor "
! "requires leading space count at %C")
! == FAILURE)
! return FAILURE;
! goto between_desc;
case FMT_SIGN:
case FMT_BLANK:
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833