aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-11-03 09:55:58 +0100
committerTobias Burnus <tobias@codesourcery.com>2020-11-03 09:55:58 +0100
commit0caf400a865cb771f76bf1025cfc2a83e8ef00ed (patch)
tree259379fab27182a6be222d90c4f7ff3ca0778481 /gcc/fortran/resolve.c
parent682ed7ad230f6177aadc060788e6f4a0780d8860 (diff)
downloadgcc-0caf400a865cb771f76bf1025cfc2a83e8ef00ed.zip
gcc-0caf400a865cb771f76bf1025cfc2a83e8ef00ed.tar.gz
gcc-0caf400a865cb771f76bf1025cfc2a83e8ef00ed.tar.bz2
Fortran: Add !GCC$ attributes DEPRECATED
gcc/fortran/ChangeLog: * decl.c (ext_attr_list): Add EXT_ATTR_DEPRECATED. * gfortran.h (ext_attr_id_t): Ditto. * gfortran.texi (GCC$ ATTRIBUTES): Document it. * resolve.c (resolve_variable, resolve_function, resolve_call, resolve_values): Show -Wdeprecated-declarations warning. * trans-decl.c (add_attributes_to_decl): Skip those with no middle_end_name. gcc/testsuite/ChangeLog: * gfortran.dg/attr_deprecated.f90: New test.
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 45c14451..1641eb6 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -3404,6 +3404,11 @@ resolve_function (gfc_expr *expr)
/* typebound procedure: Assume the worst. */
gfc_current_ns->proc_name->attr.array_outer_dependency = 1;
+ if (expr->value.function.esym
+ && expr->value.function.esym->attr.ext_attr & (1 << EXT_ATTR_DEPRECATED))
+ gfc_warning (OPT_Wdeprecated_declarations,
+ "Using function %qs at %L is deprecated",
+ sym->name, &expr->where);
return t;
}
@@ -3747,6 +3752,12 @@ resolve_call (gfc_code *c)
/* Typebound procedure: Assume the worst. */
gfc_current_ns->proc_name->attr.array_outer_dependency = 1;
+ if (c->resolved_sym
+ && c->resolved_sym->attr.ext_attr & (1 << EXT_ATTR_DEPRECATED))
+ gfc_warning (OPT_Wdeprecated_declarations,
+ "Using subroutine %qs at %L is deprecated",
+ c->resolved_sym->name, &c->loc);
+
return t;
}
@@ -5917,6 +5928,10 @@ resolve_procedure:
if (t && flag_coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
add_caf_get_intrinsic (e);
+ if (sym->attr.ext_attr & (1 << EXT_ATTR_DEPRECATED) && sym != sym->result)
+ gfc_warning (OPT_Wdeprecated_declarations,
+ "Using variable %qs at %L is deprecated",
+ sym->name, &e->where);
/* Simplify cases where access to a parameter array results in a
single constant. Suppress errors since those will have been
issued before, as warnings. */
@@ -12232,6 +12247,11 @@ resolve_values (gfc_symbol *sym)
if (sym->value == NULL)
return;
+ if (sym->attr.ext_attr & (1 << EXT_ATTR_DEPRECATED))
+ gfc_warning (OPT_Wdeprecated_declarations,
+ "Using parameter %qs declared at %L is deprecated",
+ sym->name, &sym->declared_at);
+
if (sym->value->expr_type == EXPR_STRUCTURE)
t= resolve_structure_cons (sym->value, 1);
else