From patchwork Thu Jun 24 14:07:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 56793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 63E91B6F05 for ; Fri, 25 Jun 2010 00:07:56 +1000 (EST) Received: (qmail 5448 invoked by alias); 24 Jun 2010 14:07:49 -0000 Received: (qmail 5247 invoked by uid 22791); 24 Jun 2010 14:07:45 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, TW_BG X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Jun 2010 14:07:36 +0000 Received: from [192.168.178.22] (port-92-204-17-153.dynamic.qsc.de [92.204.17.153]) by mx02.qsc.de (Postfix) with ESMTP id CAE071E1B5; Thu, 24 Jun 2010 16:07:28 +0200 (CEST) Message-ID: <4C23669F.30008@net-b.de> Date: Thu, 24 Jun 2010 16:07:27 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100317 SUSE/3.0.4 Thunderbird/3.0.4 MIME-Version: 1.0 To: Jerry DeLisle CC: Steve Kargl , gcc patches , gfortran Subject: Re: [Patch, Fortran] Add Fortran 2008 obsolescent support for ENTRY References: <4C227EE1.3000503@net-b.de> <20100623221933.GA10026@troutmask.apl.washington.edu> <4C2314FA.2000407@net-b.de> <4C236033.601@verizon.net> In-Reply-To: <4C236033.601@verizon.net> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 06/24/2010 03:40 PM, Jerry DeLisle wrote: > I wonder if there are other places where we did not use the std_gnu > correctly and we just don't see a problem yet. Several times in the > past on IRC the subject has come up about how to use that. Seemingly, I have missed two (libgfortran/io/list_read.c and fortran/io.c); now grep -r GFC_STD .|grep '<'|grep -v '\.svn' gives no output (except the #define GFC_STD lines of libgfortran.h). Updated patch attached. OK for the trunk? Tobias 2010-06-24 Tobias Burnus * decl.c (gfc_match_entry): Mark ENTRY as GFC_STD_F2008_OBS. * gfortran.texi (_gfortran_set_options): Update for GFC_STD_F2008_OBS addition. * libgfortran.h: Add GFC_STD_F2008_OBS. * options.c (set_default_std_flags, gfc_handle_option): Handle GFC_STD_F2008_OBS. io.c (check_format): Fix allow_std check. 2010-06-24 Tobias Burnus * runtime/compile_options.c (init_compile_options): Update compile_options.allow_std for GFC_STD_F2008_OBS. * io/transfer.c (formatted_transfer_scalar_read, formatted_transfer_scalar_write): Fix allow_std check. * io/list_read.c (nml_parse_qualifier): Ditto. 2010-06-24 Tobias Burnus * gfortran.dg/entry_19.f90: New. Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 161315) +++ gcc/fortran/decl.c (working copy) @@ -4963,6 +4963,10 @@ gfc_match_entry (void) if (m != MATCH_YES) return m; + if (gfc_notify_std (GFC_STD_F2008_OBS, "Fortran 2008 obsolescent feature: " + "ENTRY statement at %C") == FAILURE) + return MATCH_ERROR; + state = gfc_current_state (); if (state != COMP_SUBROUTINE && state != COMP_FUNCTION) { Index: gcc/fortran/gfortran.texi =================================================================== --- gcc/fortran/gfortran.texi (revision 161315) +++ gcc/fortran/gfortran.texi (working copy) @@ -2335,9 +2335,10 @@ if e.g. an input-output edit descriptor Possible values are (bitwise or-ed) @code{GFC_STD_F77} (1), @code{GFC_STD_F95_OBS} (2), @code{GFC_STD_F95_DEL} (4), @code{GFC_STD_F95} (8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU} (32), -@code{GFC_STD_LEGACY} (64), and @code{GFC_STD_F2008} (128). -Default: @code{GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F2003 -| GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY}. +@code{GFC_STD_LEGACY} (64), @code{GFC_STD_F2008} (128), and +@code{GFC_STD_F2008_OBS} (256). Default: @code{GFC_STD_F95_OBS +| GFC_STD_F95_DEL | GFC_STD_F95 | GFC_STD_F2003 | GFC_STD_F2008 +| GFC_STD_F2008_OBS | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY}. @item @var{option}[1] @tab Standard-warning flag; prints a warning to standard error. Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}. @item @var{option}[2] @tab If non zero, enable pedantic checking. Index: gcc/fortran/libgfortran.h =================================================================== --- gcc/fortran/libgfortran.h (revision 161315) +++ gcc/fortran/libgfortran.h (working copy) @@ -23,15 +23,16 @@ along with GCC; see the file COPYING3. Note that no features were obsoleted nor deleted in F2003. Please remember to keep those definitions in sync with gfortran.texi. */ -#define GFC_STD_F2008 (1<<7) /* New in F2008. */ -#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */ -#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */ -#define GFC_STD_F2003 (1<<4) /* New in F2003. */ -#define GFC_STD_F95 (1<<3) /* New in F95. */ -#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */ -#define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */ -#define GFC_STD_F77 (1<<0) /* Included in F77, but not deleted or - obsolescent in later standards. */ +#define GFC_STD_F2008_OBS (1<<8) /* Obsolescent in F2008. */ +#define GFC_STD_F2008 (1<<7) /* New in F2008. */ +#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */ +#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */ +#define GFC_STD_F2003 (1<<4) /* New in F2003. */ +#define GFC_STD_F95 (1<<3) /* New in F95. */ +#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */ +#define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */ +#define GFC_STD_F77 (1<<0) /* Included in F77, but not deleted or + obsolescent in later standards. */ /* Bitmasks for the various FPE that can be enabled. */ Index: gcc/fortran/options.c =================================================================== --- gcc/fortran/options.c (revision 161315) +++ gcc/fortran/options.c (working copy) @@ -48,7 +48,7 @@ set_default_std_flags (void) { gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77 - | GFC_STD_GNU | GFC_STD_LEGACY; + | GFC_STD_F2008_OBS | GFC_STD_GNU | GFC_STD_LEGACY; gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY; } @@ -857,7 +857,8 @@ gfc_handle_option (size_t scode, const c break; case OPT_std_f95: - gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77; + gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77 + | GFC_STD_F2008_OBS; gfc_option.warn_std = GFC_STD_F95_OBS; gfc_option.max_continue_fixed = 19; gfc_option.max_continue_free = 39; @@ -868,7 +869,7 @@ gfc_handle_option (size_t scode, const c case OPT_std_f2003: gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77 - | GFC_STD_F2003 | GFC_STD_F95; + | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008_OBS; gfc_option.warn_std = GFC_STD_F95_OBS; gfc_option.max_identifier_length = 63; gfc_option.warn_ampersand = 1; @@ -877,8 +878,8 @@ gfc_handle_option (size_t scode, const c case OPT_std_f2008: gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77 - | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008; - gfc_option.warn_std = GFC_STD_F95_OBS; + | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008 | GFC_STD_F2008_OBS; + gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS; gfc_option.max_identifier_length = 63; gfc_option.warn_ampersand = 1; gfc_option.warn_tabs = 0; Index: gcc/fortran/io.c =================================================================== --- gcc/fortran/io.c (revision 161315) +++ gcc/fortran/io.c (working copy) @@ -730,7 +730,7 @@ data_desc: t = format_lex (); if (t == FMT_ERROR) goto fail; - if (gfc_option.allow_std < GFC_STD_F2003 && t != FMT_COMMA + if (!(gfc_option.allow_std & GFC_STD_F2003) && t != FMT_COMMA && t != FMT_F && t != FMT_E && t != FMT_EN && t != FMT_ES && t != FMT_D && t != FMT_G && t != FMT_RPAREN && t != FMT_SLASH) { Index: libgfortran/runtime/compile_options.c =================================================================== --- libgfortran/runtime/compile_options.c (revision 161310) +++ libgfortran/runtime/compile_options.c (working copy) @@ -1,7 +1,7 @@ /* Handling of compile-time options that influence the library. - Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. -This file is part of the GNU Fortran 95 runtime library (libgfortran). +This file is part of the GNU Fortran runtime library (libgfortran). Libgfortran is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -138,7 +138,7 @@ init_compile_options (void) compile_options.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY; compile_options.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77 - | GFC_STD_GNU | GFC_STD_LEGACY; + | GFC_STD_F2008_OBS | GFC_STD_GNU | GFC_STD_LEGACY; compile_options.pedantic = 0; compile_options.dump_core = 0; compile_options.backtrace = 0; Index: libgfortran/io/list_read.c =================================================================== --- libgfortran/io/list_read.c (revision 161310) +++ libgfortran/io/list_read.c (working copy) @@ -2077,7 +2077,7 @@ nml_parse_qualifier (st_parameter_dt *dt /* If -std=f95/2003 or an array section is specified, do not allow excess data to be processed. */ if (is_array_section == 1 - || compile_options.allow_std < GFC_STD_GNU) + || !(compile_options.allow_std & GFC_STD_GNU)) ls[dim].end = ls[dim].start; else dtp->u.p.expanded_read = 1; Index: libgfortran/io/transfer.c =================================================================== --- libgfortran/io/transfer.c (revision 161310) +++ libgfortran/io/transfer.c (working copy) @@ -4,7 +4,7 @@ Namelist transfer functions contributed by Paul Thomas F2003 I/O support contributed by Jerry DeLisle -This file is part of the GNU Fortran 95 runtime library (libgfortran). +This file is part of the GNU Fortran runtime library (libgfortran). Libgfortran is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1042,7 +1042,7 @@ formatted_transfer_scalar_read (st_param case FMT_B: if (n == 0) goto need_read_data; - if (compile_options.allow_std < GFC_STD_GNU + if (!(compile_options.allow_std & GFC_STD_GNU) && require_type (dtp, BT_INTEGER, type, f)) return; read_radix (dtp, f, p, kind, 2); @@ -1051,7 +1051,7 @@ formatted_transfer_scalar_read (st_param case FMT_O: if (n == 0) goto need_read_data; - if (compile_options.allow_std < GFC_STD_GNU + if (!(compile_options.allow_std & GFC_STD_GNU) && require_type (dtp, BT_INTEGER, type, f)) return; read_radix (dtp, f, p, kind, 8); @@ -1060,7 +1060,7 @@ formatted_transfer_scalar_read (st_param case FMT_Z: if (n == 0) goto need_read_data; - if (compile_options.allow_std < GFC_STD_GNU + if (!(compile_options.allow_std & GFC_STD_GNU) && require_type (dtp, BT_INTEGER, type, f)) return; read_radix (dtp, f, p, kind, 16); @@ -1443,7 +1443,7 @@ formatted_transfer_scalar_write (st_para case FMT_B: if (n == 0) goto need_data; - if (compile_options.allow_std < GFC_STD_GNU + if (!(compile_options.allow_std & GFC_STD_GNU) && require_type (dtp, BT_INTEGER, type, f)) return; write_b (dtp, f, p, kind); @@ -1452,7 +1452,7 @@ formatted_transfer_scalar_write (st_para case FMT_O: if (n == 0) goto need_data; - if (compile_options.allow_std < GFC_STD_GNU + if (!(compile_options.allow_std & GFC_STD_GNU) && require_type (dtp, BT_INTEGER, type, f)) return; write_o (dtp, f, p, kind); @@ -1461,7 +1461,7 @@ formatted_transfer_scalar_write (st_para case FMT_Z: if (n == 0) goto need_data; - if (compile_options.allow_std < GFC_STD_GNU + if (!(compile_options.allow_std & GFC_STD_GNU) && require_type (dtp, BT_INTEGER, type, f)) return; write_z (dtp, f, p, kind); Index: gcc/testsuite/gfortran.dg/entry_19.f90 =================================================================== --- gcc/testsuite/gfortran.dg/entry_19.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/entry_19.f90 (revision 0) @@ -0,0 +1,9 @@ +! { dg-do compile } +! { dg-options "-std=f2008" } +! +! +! Entry is obsolete in Fortran 2008 +! +subroutine foo() +entry bar() ! { dg-error "Fortran 2008 obsolescent feature: ENTRY" } +end