aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2018-06-10 10:20:50 +0200
committerJanus Weil <janus@gcc.gnu.org>2018-06-10 10:20:50 +0200
commitea20e8be960c53892f3fda4248b77616e7cf1444 (patch)
tree1070506fea961cca0fcb3dff25e39985cc681c96 /gcc/fortran/decl.c
parent3a579cbe0781a62146c4ddf430ae0e40c3f75f0f (diff)
downloadgcc-ea20e8be960c53892f3fda4248b77616e7cf1444.zip
gcc-ea20e8be960c53892f3fda4248b77616e7cf1444.tar.gz
gcc-ea20e8be960c53892f3fda4248b77616e7cf1444.tar.bz2
re PR fortran/85088 (improve diagnostic for bad INTENT declaration ('Invalid character in name at'))
2018-06-10 Janus Weil <janus@gcc.gnu.org> PR fortran/85088 * decl.c (match_attr_spec): Synchronize the DECL_* enum values with the INTENT_* values from the enum 'sym_intent'. Call 'match_intent_spec' and remove a TODO note. * gfortran.h: Add a comment to sym_intent. 2018-06-10 Janus Weil <janus@gcc.gnu.org> PR fortran/85088 * gfortran.dg/intent_decl_1.f90: New test case. From-SVN: r261386
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index c36a16b..707c2a7 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4726,9 +4726,10 @@ match_attr_spec (void)
{
/* Modifiers that can exist in a type statement. */
enum
- { GFC_DECL_BEGIN = 0,
- DECL_ALLOCATABLE = GFC_DECL_BEGIN, DECL_DIMENSION, DECL_EXTERNAL,
- DECL_IN, DECL_OUT, DECL_INOUT, DECL_INTRINSIC, DECL_OPTIONAL,
+ { GFC_DECL_BEGIN = 0, DECL_ALLOCATABLE = GFC_DECL_BEGIN,
+ DECL_IN = INTENT_IN, DECL_OUT = INTENT_OUT, DECL_INOUT = INTENT_INOUT,
+ DECL_DIMENSION, DECL_EXTERNAL,
+ DECL_INTRINSIC, DECL_OPTIONAL,
DECL_PARAMETER, DECL_POINTER, DECL_PROTECTED, DECL_PRIVATE,
DECL_STATIC, DECL_AUTOMATIC,
DECL_PUBLIC, DECL_SAVE, DECL_TARGET, DECL_VALUE, DECL_VOLATILE,
@@ -4739,6 +4740,9 @@ match_attr_spec (void)
/* GFC_DECL_END is the sentinel, index starts at 0. */
#define NUM_DECL GFC_DECL_END
+ /* Make sure that values from sym_intent are safe to be used here. */
+ gcc_assert (INTENT_IN > 0);
+
locus start, seen_at[NUM_DECL];
int seen[NUM_DECL];
unsigned int d;
@@ -4856,13 +4860,12 @@ match_attr_spec (void)
if (match_string_p ("nt"))
{
/* Matched "intent". */
- /* TODO: Call match_intent_spec from here. */
- if (gfc_match (" ( in out )") == MATCH_YES)
- d = DECL_INOUT;
- else if (gfc_match (" ( in )") == MATCH_YES)
- d = DECL_IN;
- else if (gfc_match (" ( out )") == MATCH_YES)
- d = DECL_OUT;
+ d = match_intent_spec ();
+ if (d == INTENT_UNKNOWN)
+ {
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
}
}
else if (ch == 'r')