This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran] PR 85088: improve diagnostic for bad INTENT declaration
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: Janus Weil <janus at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 9 Jun 2018 14:12:55 +0200
- Subject: Re: [Patch, Fortran] PR 85088: improve diagnostic for bad INTENT declaration
- References: <CAKwh3qhQHynkFmKcytgmH5G=E66NDK8P=MQ6xdrxtjFU=izAQw@mail.gmail.com>
Hi Janus,
I like what the patch does. However, I have one concern.
* decl.c (match_attr_spec): Synchronize the DECL_* enum values with the
INTENT_* values from the enum 'sym_intent'.
This part
+ { 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,
brings a dependency of the values of sym_intent into this enum.
I know that the order of sym_intent is not likely to change, but I would
still prefer if you could add a comment to the sym_intent definition in
gfortran.h noting that INTENT_IN cannot be zero, and add a
gcc_assert (INTENT_IN > 0);
somewhere (which will be optimized away) with an explanatory comment.
OK with that change.
Thanks for the patch!
Thomas