[PATCH v2] gdb/fortran: Align intrinsic/variable precedence
Tom Tromey
tromey@adacore.com
Wed Aug 2 17:17:19 GMT 2023
>>>>> "Richard" == Richard Bunt via Gdb-patches <gdb-patches@sourceware.org> writes:
Richard> Fortran allows variables and function to be named after language defined
Richard> intrinsics as they are not reserved keywords. For example, the abs maths
Richard> intrinsic can be hidden by a user declaring a variable called abs.
Thank you for the patch.
Richard> +static const struct token f_intrinsics[] =
Richard> +{
Richard> + /* This is post the symbol search as symbols can hide intrinsics. Also,
Richard> + give Fortran intrinsics priority over C symbols. This prevents
Richard> + non-Fortran symbols from hiding intrinsics, for example abs. */
Richard> + if (!result.symbol || result.symbol->language () != language_fortran)
Richard> + for (int i = 0; i < ARRAY_SIZE (f_intrinsics); i++)
Richard> + {
I think it's better to use foreach here, as is done for f_keywords:
for (const auto &keyword : f_keywords)
...
Otherwise this looks good, thank you.
Tom
More information about the Gdb-patches
mailing list