Commit b7892582 by Janne Blomqvist Committed by Paul Brook

re PR fortran/17590 (Standard conformance should take intrinsics into account.)

2004-10-31  Janne Blomqvist  <jblomqvi@cc.hut.fi>

	PR fortran/17590
	* gfortran.h: Change GFC_STD_* flags to more appropriate
	ones. (struct gfc_intrinsic_isym): Add field for standard. (struct
	gfc_option_t): Add field for warning about use of nonstandard
	intrinsics.
	* intrinsic.c (add_sym): Add parameter for standard version, check
	this against current standard.
	(add_sym_0): Pass standard parameter to add_sym.
	(add_sym_1, add_sym_0s, add_sym_1s, add_sym_1m, add_sym_2): Ditto.
	(add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s): Ditto.
	(add_sym_4, add_sym_4s, add_sym_5, add_sym_5s): Ditto.
	(make_generic): Add parameter for standard, check this
	against currently selected standard.
	(add_functions, add_subroutines): Add parameter to tell which
	standard an intrinsic belongs to.
	(check_intrinsic_standard): New function.
	(gfc_intrinsic_func_interface): Add call to check_intrinsic_standard.
	(gfc_intrinsic_sub_interface): Ditto.
	* lang.opt: Add Wnonstd-intrinsics option.
	* options.c (gfc_init_options): Change to use new GFC_STD_* flags,
	init new warning.
	(set_Wall): Add warning about nonstd intrinsics.
	(gfc_handle_option): Change to use new GFC_STD_* flags,
	handle new warning.
	* invoke.texi: Update manual to include -Wnonstd-intrinsics.

From-SVN: r89907
parent 13747d3e
2004-10-31 Janne Blomqvist <jblomqvi@cc.hut.fi>
PR fortran/17590
* gfortran.h: Change GFC_STD_* flags to more appropriate
ones. (struct gfc_intrinsic_isym): Add field for standard. (struct
gfc_option_t): Add field for warning about use of nonstandard
intrinsics.
* intrinsic.c (add_sym): Add parameter for standard version, check
this against current standard.
(add_sym_0): Pass standard parameter to add_sym.
(add_sym_1, add_sym_0s, add_sym_1s, add_sym_1m, add_sym_2): Ditto.
(add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s): Ditto.
(add_sym_4, add_sym_4s, add_sym_5, add_sym_5s): Ditto.
(make_generic): Add parameter for standard, check this
against currently selected standard.
(add_functions, add_subroutines): Add parameter to tell which
standard an intrinsic belongs to.
(check_intrinsic_standard): New function.
(gfc_intrinsic_func_interface): Add call to check_intrinsic_standard.
(gfc_intrinsic_sub_interface): Ditto.
* lang.opt: Add Wnonstd-intrinsics option.
* options.c (gfc_init_options): Change to use new GFC_STD_* flags,
init new warning.
(set_Wall): Add warning about nonstd intrinsics.
(gfc_handle_option): Change to use new GFC_STD_* flags,
handle new warning.
* invoke.texi: Update manual to include -Wnonstd-intrinsics.
2004-10-30 Andrew Pinski <pinskia@physics.uc.edu>
* f95-lang.c (lang_tree_node): Add chain_next to be the TREE_CHAIN.
......
......@@ -97,12 +97,13 @@ mstring;
/* Flags to specify which standardi/extension contains a feature. */
#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
#define GFC_STD_F2003 (1<<4) /* New in F2003. */
#define GFC_STD_F2003_DEL (1<<3) /* Deleted in F2003. */
#define GFC_STD_F2003_OBS (1<<2) /* Obsoleted in F2003. */
#define GFC_STD_F95_DEL (1<<1) /* Deleted in F95. */
#define GFC_STD_F95_OBS (1<<0) /* Obsoleted in F95. */
#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
#define GFC_STD_F2003 (1<<4) /* New in F2003. */
/* Note that no features were obsoleted nor deleted 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) /* Obsoleted in F95. */
#define GFC_STD_F77 (1<<0) /* Up to and including F77. */
/*************************** Enums *****************************/
......@@ -1004,7 +1005,7 @@ typedef struct gfc_intrinsic_sym
char name[GFC_MAX_SYMBOL_LEN + 1], lib_name[GFC_MAX_SYMBOL_LEN + 1];
gfc_intrinsic_arg *formal;
gfc_typespec ts;
int elemental, pure, generic, specific, actual_ok;
int elemental, pure, generic, specific, actual_ok, standard;
gfc_simplify_f simplify;
gfc_check_f check;
......@@ -1403,6 +1404,7 @@ typedef struct
int d8;
int warn_std;
int allow_std;
int warn_nonstd_intrinsics;
}
gfc_option_t;
......
......@@ -126,8 +126,8 @@ by type. Explanations are in the following sections.
@gccoptlist{
-fsyntax-only -pedantic -pedantic-errors @gol
-w -Wall -Waliasing -Wconversion @gol
-Wimplicit-interface -Wsurprising -Wunderflow -Wunused-labels @gol
-Wline-truncation @gol
-Wimplicit-interface -Wnonstd-intrinsics -Wsurprising -Wunderflow @gol
-Wunused-labels -Wline-truncation @gol
-Werror -W}
@item Debugging Options
......@@ -321,7 +321,8 @@ Inhibit all warning messages.
Enables commonly used warning options that which pertain to usage that
we recommend avoiding and that we believe is easy to avoid.
This currently includes @option{-Wunused-labels}, @option{-Waliasing},
@option{-Wsurprising} and @option{-Wline-truncation}.
@option{-Wsurprising}, @option{-Wnonstd-intrinsic} and
@option{-Wline-truncation}.
@cindex -Waliasing option
......@@ -352,6 +353,13 @@ Note this only checks that an explicit interface is present. It does not
check that the declared interfaces are consistent across program units.
@cindex -Wnonstd-intrinsic option
@cindex options, -Wnonstd-intrinsic
@item -Wnonstd-intrinsic
Warn if the user tries to use an intrinsic that does not belong to the
standard the user has chosen via the -std option.
@cindex -Wsurprising
@cindex options, -Wsurprising
@item -Wsurprising
......
......@@ -53,6 +53,10 @@ Wline-truncation
F95
Warn about truncated source lines
Wnonstd-intrinsics
F95
Warn about usage of non-standard intrinsics
Wsurprising
F95
Warn about \"suspicious\" constructs
......
......@@ -78,10 +78,12 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
flag_argument_noalias = 2;
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003_OBS | GFC_STD_F2003_DEL | GFC_STD_F2003 | GFC_STD_GNU;
| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003;
gfc_option.warn_nonstd_intrinsics = 0;
return CL_F95;
}
......@@ -131,6 +133,7 @@ set_Wall (void)
gfc_option.warn_underflow = 1;
gfc_option.warn_surprising = 1;
gfc_option.warn_unused_labels = 1;
gfc_option.warn_nonstd_intrinsics = 1;
set_Wunused (1);
warn_return_type = 1;
......@@ -309,24 +312,27 @@ 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_F2003_OBS
| GFC_STD_F2003_DEL;
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
gfc_option.warn_std = GFC_STD_F95_OBS;
gfc_option.max_identifier_length = 31;
break;
case OPT_std_f2003:
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F2003_OBS
| GFC_STD_F2003;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2003_OBS;
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
| GFC_STD_F2003 | GFC_STD_F95;
gfc_option.warn_std = GFC_STD_F95_OBS;
gfc_option.max_identifier_length = 63;
break;
case OPT_std_gnu:
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003_OBS | GFC_STD_F2003_DEL | GFC_STD_F2003 | GFC_STD_GNU;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003_OBS | GFC_STD_F2003_DEL;
| GFC_STD_F77 | GFC_STD_F95 | GFC_STD_F2003
| GFC_STD_GNU;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL;
break;
case OPT_Wnonstd_intrinsics:
gfc_option.warn_nonstd_intrinsics = 1;
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment