From 58fc89f6b9dfb78d857c08ecc5135dfcca1c3702 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 25 Jun 2010 21:17:21 +0200 Subject: [PATCH] decl.c (gfc_match_entry): Mark ENTRY as GFC_STD_F2008_OBS. 2010-06-25 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-25 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-25 Tobias Burnus * gfortran.dg/entry_19.f90: New. From-SVN: r161409 --- gcc/fortran/ChangeLog | 10 ++++++++++ gcc/fortran/decl.c | 4 ++++ gcc/fortran/gfortran.texi | 7 ++++--- gcc/fortran/io.c | 2 +- gcc/fortran/libgfortran.h | 19 ++++++++++--------- gcc/fortran/options.c | 11 ++++++----- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/entry_19.f90 | 9 +++++++++ libgfortran/ChangeLog | 8 ++++++++ libgfortran/io/list_read.c | 2 +- libgfortran/io/transfer.c | 14 +++++++------- libgfortran/runtime/compile_options.c | 6 +++--- 12 files changed, 67 insertions(+), 29 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/entry_19.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b3da9a3..cb551de 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,15 @@ 2010-06-25 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-25 Tobias Burnus + * decl.c (gfc_match_entry): Allow END besides END SUBROUTINE/END FUNCTION for contained procedures. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 73bc81c..c2b1ff2 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -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) { diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 939ae61..8d43c8b 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -2335,9 +2335,10 @@ if e.g. an input-output edit descriptor is invalid in a given standard. 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. diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index dc20bc2..f9a6d7b 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -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) { diff --git a/gcc/fortran/libgfortran.h b/gcc/fortran/libgfortran.h index 85bd43d..d9216d3 100644 --- a/gcc/fortran/libgfortran.h +++ b/gcc/fortran/libgfortran.h @@ -23,15 +23,16 @@ along with GCC; see the file COPYING3. If not see 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. */ diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 3b8b8dc..af537a1 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -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 char *arg, int value, 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 char *arg, int value, 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 char *arg, int value, 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b71f778..f06c7a1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2010-06-25 Tobias Burnus + * gfortran.dg/entry_19.f90: New. + +2010-06-25 Tobias Burnus + * gfortran.dg/end_subroutine_1.f90: New. * gfortran.dg/end_subroutine_2.f90: New. * gfortran.dg/interface_proc_end.f90: Update. diff --git a/gcc/testsuite/gfortran.dg/entry_19.f90 b/gcc/testsuite/gfortran.dg/entry_19.f90 new file mode 100644 index 0000000..b7b8bfa --- /dev/null +++ b/gcc/testsuite/gfortran.dg/entry_19.f90 @@ -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 diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 83ff864..129841b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,11 @@ +2010-06-25 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-18 Jerry DeLisle PR libfortran/44477 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 2f0f931..798521d 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2077,7 +2077,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, /* 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; diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 9f2aafa..f44c025 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -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_parameter_dt *dtp, bt type, void *p, int kind 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_parameter_dt *dtp, bt type, void *p, int kind 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_parameter_dt *dtp, bt type, void *p, int kind 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_parameter_dt *dtp, bt type, void *p, int kin 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_parameter_dt *dtp, bt type, void *p, int kin 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_parameter_dt *dtp, bt type, void *p, int kin 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); diff --git a/libgfortran/runtime/compile_options.c b/libgfortran/runtime/compile_options.c index c3d26f4..62c401b 100644 --- a/libgfortran/runtime/compile_options.c +++ b/libgfortran/runtime/compile_options.c @@ -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; -- 2.7.4