[PATCH 3/3] fortran: array descriptor: Move dtype layout constants out of header [PR122521]
Mikael Morin <[email protected]> Tue, 28 Jul 2026 17:20:12 +0200
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.fortran |
|---|---|
| Message-ID | <[email protected]> |
From: Mikael Morin <[email protected]> Fortran-tested on aarch64-unknown-linux-gnu. OK for mainline? -- >8 -- The file trans.h contains preprocessor constants describing the ordering of the dtype subfields of array descriptors. The functions using them have been moved to trans-descriptor.cc; now move the constants themselves. PR fortran/122521 gcc/fortran/ChangeLog: * trans.h (GFC_DTYPE_ELEM_LEN, GFC_DTYPE_VERSION, GFC_DTYPE_RANK, GFC_DTYPE_TYPE, GFC_DTYPE_ATTRIBUTE): Move preprocessor constants... * trans-descriptor.cc (GFC_DTYPE_ELEM_LEN, GFC_DTYPE_VERSION, GFC_DTYPE_RANK, GFC_DTYPE_TYPE, GFC_DTYPE_ATTRIBUTE): ... here. Undefine the constants after the last function using them. --- gcc/fortran/trans-descriptor.cc | 13 +++++++++++++ gcc/fortran/trans.h | 6 ------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index e20159fa3c6..5a92cbba4da 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -61,6 +61,12 @@ along with GCC; see the file COPYING3. If not see #define LBOUND_SUBFIELD 1 #define UBOUND_SUBFIELD 2 +#define GFC_DTYPE_ELEM_LEN 0 +#define GFC_DTYPE_VERSION 1 +#define GFC_DTYPE_RANK 2 +#define GFC_DTYPE_TYPE 3 +#define GFC_DTYPE_ATTRIBUTE 4 + /* Get FIELD_IDX'th field in struct TYPE. */ @@ -697,10 +703,17 @@ gfc_build_null_descriptor (tree type) #undef SPAN_FIELD #undef DIMENSION_FIELD #undef CAF_TOKEN_FIELD + #undef STRIDE_SUBFIELD #undef LBOUND_SUBFIELD #undef UBOUND_SUBFIELD +#undef GFC_DTYPE_ELEM_LEN +#undef GFC_DTYPE_VERSION +#undef GFC_DTYPE_RANK +#undef GFC_DTYPE_TYPE +#undef GFC_DTYPE_ATTRIBUTE + /* For an array descriptor, get the total number of elements. This is just the product of the extents along from_dim to to_dim. */ diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 0bdee5820fd..ca766e0a339 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -1016,12 +1016,6 @@ extern GTY(()) tree gfor_fndecl_cfi_deep_copy_array; /* gfortran-specific declaration information, the _CONT versions denote arrays with CONTIGUOUS attribute. */ -#define GFC_DTYPE_ELEM_LEN 0 -#define GFC_DTYPE_VERSION 1 -#define GFC_DTYPE_RANK 2 -#define GFC_DTYPE_TYPE 3 -#define GFC_DTYPE_ATTRIBUTE 4 - enum gfc_array_kind { GFC_ARRAY_UNKNOWN, -- 2.53.0