[Patch, Fortran] PR 40881: warn for obsolescent features

Janus Weil janus@gcc.gnu.org
Sat Aug 1 16:58:00 GMT 2009


Hi all,

the Fortran 90 standard lists nine "obsolescent" f77 features, which
continue to be supported in f90, but may be deleted in the future.
Therefore their usage is discouraged by the standard. Currently, we
only warn about two of them (arithmetic if and assumed length
character functions). This patch adds warnings for four more:

* alternate return
* computed goto
* statement functions
* old-style character lengths ["character*..." instead of "character(...)"]

That leaves three obsolescent features, which are not warned about:

* shared DO termination
* DATA statements among executable statements
* fixed form source

These may be added later.

The patch is technically very simple, but has a rather large impact on
the testsuite, since lots of test cases use old-style character
lengths. For most of them I just added -std=legacy. But some already
use -std=f95, so I had to change the character lengths to f90 style or
add a dg-warning. For the already-implemented obsolescent warnings I
changed the message to unify it with the new ones, so I also had to
change some dg-warnings in the testsuite.

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2009-08-01  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40881
	* decl.c (match_char_length): Warn about old-style character length
	declarations.
	* match.c (match_arithmetic_if,gfc_match_if): Modify warning message
	for arithmetic if.
	(gfc_match_goto): Warn about computed gotos.
	(gfc_match_return): Warn about alternate return.
	(gfc_match_st_function): Warn about statement functions.
	* resolve.c (resolve_fl_procedure): Modify warning message for
	assumed-length character functions.


2009-08-01  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40881
	* gfortran.dg/aliasing_dummy_1.f90: Add -std=legacy.
	* gfortran.dg/altreturn_3.f90: Ditto.
	* gfortran.dg/altreturn_5.f90: Ditto.
	* gfortran.dg/altreturn_6.f90: Ditto.
	* gfortran.dg/altreturn_7.f90: Ditto.
	* gfortran.dg/array_constructor_13.f90: Ditto.
	* gfortran.dg/arrayio_7.f90: Ditto.
	* gfortran.dg/arrayio_8.f90: Ditto.
	* gfortran.dg/assumed_charlen_function_3.f90: Modified warning message.
	* gfortran.dg/assumed_charlen_function_4.f90: Add -std=legacy.
	* gfortran.dg/assumed_charlen_function_5.f90: Modified warning message.
	* gfortran.dg/backspace_8.f: Add -std=legacy.
	* gfortran.dg/backspace_9.f: Ditto.
	* gfortran.dg/char_comparison_1.f: Ditto.
	* gfortran.dg/char_decl_1.f90: Ditto.
	* gfortran.dg/char_initialiser_actual.f90: Ditto.
	* gfortran.dg/char_pointer_assign.f90: Ditto.
	* gfortran.dg/char_pointer_dependency.f90: Ditto.
	* gfortran.dg/char_pointer_dummy.f90: Ditto.
	* gfortran.dg/char_pointer_func.f90: Ditto.
	* gfortran.dg/common_8.f90: Ditto.
	* gfortran.dg/constant_substring.f: Ditto.
	* gfortran.dg/data_char_2.f90: Ditto.
	* gfortran.dg/der_array_io_1.f90: Ditto.
	* gfortran.dg/der_array_io_2.f90: Ditto.
	* gfortran.dg/der_array_io_3.f90: Ditto.
	* gfortran.dg/der_io_3.f90: Ditto.
	* gfortran.dg/dev_null.F90: Ditto.
	* gfortran.dg/direct_io_2.f90: Ditto.
	* gfortran.dg/do_iterator_2.f90: Ditto.
	* gfortran.dg/e_d_fmt.f90: Ditto.
	* gfortran.dg/empty_format_1.f90: Ditto.
	* gfortran.dg/entry_17.f90: Modified warning message.
	* gfortran.dg/entry_7.f90: Add -std=legacy.
	* gfortran.dg/eor_1.f90: Ditto.
	* gfortran.dg/equiv_2.f90: Ditto.
	* gfortran.dg/equiv_constraint_2.f90: Use new-style character length.
	* gfortran.dg/equiv_substr.f90: Add -std=legacy.
	* gfortran.dg/extended_char_comparison_1.f: Ditto.
	* gfortran.dg/fmt_bz_bn_err.f: Ditto.
	* gfortran.dg/fmt_error_2.f90: Ditto.
	* gfortran.dg/fmt_read_bz_bn.f90: Ditto.
	* gfortran.dg/fmt_tl.f: Ditto.
	* gfortran.dg/fmt_white.f: Ditto.
	* gfortran.dg/func_derived_1.f90: Ditto.
	* gfortran.dg/g77_intrinsics_funcs.f: Ditto.
	* gfortran.dg/g77_intrinsics_sub.f: Ditto.
	* gfortran.dg/global_references_2.f90: Ditto.
	* gfortran.dg/hollerith_1.f90: Ditto.
	* gfortran.dg/hollerith.f90: Use new-style character length.
	* gfortran.dg/hollerith_f95.f90: Ditto.
	* gfortran.dg/ichar_1.f90: Add -std=legacy.
	* gfortran.dg/implicit_6.f90: Ditto.
	* gfortran.dg/implicit_9.f90: Ditto.
	* gfortran.dg/inquire_13.f90: Ditto.
	* gfortran.dg/inquire_5.f90: Ditto.
	* gfortran.dg/inquire_6.f90: Ditto.
	* gfortran.dg/inquire.f90: Ditto.
	* gfortran.dg/io_constraints_1.f90: Use new-style character length.
	* gfortran.dg/io_constraints_2.f90: Ditto.
	* gfortran.dg/list_read_2.f90: Add -std=legacy.
	* gfortran.dg/loc_2.f90: Ditto.
	* gfortran.dg/logical_1.f90: Ditto.
	* gfortran.dg/longline.f: Ditto.
	* gfortran.dg/merge_char_1.f90: Ditto.
	* gfortran.dg/namelist_12.f: Ditto.
	* gfortran.dg/namelist_14.f90: Ditto.
	* gfortran.dg/namelist_18.f90: Ditto.
	* gfortran.dg/namelist_19.f90: Ditto.
	* gfortran.dg/namelist_21.f90: Ditto.
	* gfortran.dg/namelist_22.f90: Ditto.
	* gfortran.dg/namelist_37.f90: Ditto.
	* gfortran.dg/namelist_54.f90: Ditto.
	* gfortran.dg/namelist_55.f90: Ditto.
	* gfortran.dg/namelist_empty.f90: Ditto.
	* gfortran.dg/namelist_use.f90: Use new-style character length.
	* gfortran.dg/namelist_use_only.f90: Add -std=legacy.
	* gfortran.dg/nested_modules_4.f90: Ditto.
	* gfortran.dg/nested_modules_5.f90: Ditto.
	* gfortran.dg/open-options-blanks.f: Ditto.
	* gfortran.dg/output_exponents_1.f90: Ditto.
	* gfortran.dg/parens_5.f90: Ditto.
	* gfortran.dg/parens_6.f90: Ditto.
	* gfortran.dg/parent_result_ref_2.f90: Modified warning message.
	* gfortran.dg/pointer_function_actual_1.f90: Add -std=legacy.
	* gfortran.dg/pr15129.f90: Ditto.
	* gfortran.dg/pr15332.f: Ditto.
	* gfortran.dg/pr16597.f90: Ditto.
	* gfortran.dg/pr17143.f90: Ditto.
	* gfortran.dg/pr17164.f90: Ditto.
	* gfortran.dg/pr17229.f: Modified warning message.
	* gfortran.dg/pr18210.f90: Add -std=legacy.
	* gfortran.dg/pr19155.f: Ditto.
	* gfortran.dg/pr20086.f90: Ditto.
	* gfortran.dg/pr20124.f90: Ditto.
	* gfortran.dg/pr20755.f: Ditto.
	* gfortran.dg/pr20865.f90: Ditto.
	* gfortran.dg/pr20950.f: Ditto.
	* gfortran.dg/pr21730.f: Ditto.
	* gfortran.dg/pr22491.f: Ditto.
	* gfortran.dg/pr29713.f90: Ditto.
	* gfortran.dg/print_parentheses_1.f: Ditto.
	* gfortran.dg/print_parentheses_2.f90: Ditto.
	* gfortran.dg/proc_assign_1.f90: Ditto.
	* gfortran.dg/proc_decl_1.f90: Ditto.
	* gfortran.dg/proc_ptr_17.f90: Add dg-warning.
	* gfortran.dg/read_eor.f90: : Add -std=legacy.
	* gfortran.dg/read_float_1.f90: Ditto.
	* gfortran.dg/read_logical.f90: Ditto.
	* gfortran.dg/recursive_statement_functions.f90: Ditto.
	* gfortran.dg/return_1.f90: Ditto.
	* gfortran.dg/rewind_1.f90: Ditto.
	* gfortran.dg/runtime_warning_1.f90: Use new-style character length.
	* gfortran.dg/scalar_return_1.f90: Add -std=legacy.
	* gfortran.dg/stfunc_1.f90: Ditto.
	* gfortran.dg/stfunc_3.f90: Ditto.
	* gfortran.dg/stfunc_4.f90: Ditto.
	* gfortran.dg/stfunc_6.f90: Ditto.
	* gfortran.dg/streamio_2.f90: Ditto.
	* gfortran.dg/string_ctor_1.f90: Ditto.
	* gfortran.dg/string_null_compare_1.f: Ditto.
	* gfortran.dg/substr_6.f90: Ditto.
	* gfortran.dg/tl_editing.f90: Ditto.
	* gfortran.dg/unf_io_convert_1.f90: Use new-style character length.
	* gfortran.dg/warnings_are_errors_1.f90: Modified warning message.
	* gfortran.dg/x_slash_1.f: Add -std=legacy.
	* gfortran.dg/g77/1832.f: Ditto.
	* gfortran.dg/g77/19981216-0.f Ditto.
	* gfortran.dg/g77/19990525-0.f: Ditto.
	* gfortran.dg/g77/19990826-2.f: Ditto.
	* gfortran.dg/g77/20000630-2.f: Ditto.
	* gfortran.dg/g77/20010116.f: Ditto.
	* gfortran.dg/g77/20010519-1.f: Use new-style character length.
	* gfortran.dg/g77/980419-2.f: Add -std=legacy.
	* gfortran.dg/g77/980520-1.f: Ditto.
	* gfortran.dg/g77/check0.f: Ditto.
	* gfortran.dg/g77/cpp3.F: Ditto.
	* gfortran.dg/g77/cpp4.F: Use new-style character length.
	* gfortran.dg/g77/f77-edit-i-in.f: Add -std=legacy.
	* gfortran.dg/g77/f77-edit-t-in.f: Ditto.
	* gfortran.dg/g77/short.f: Ditto.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr40881.diff
Type: text/x-diff
Size: 71829 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090801/1e463c4b/attachment.bin>


More information about the Gcc-patches mailing list