diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-02-12 19:53:17 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-02-12 19:53:17 +0000 |
commit | e9bfdf18cb4f6fd6d323bc1a9008d2e717670ff7 (patch) | |
tree | 02ed85c48bc8966ec79c5aace72da2283178c8e6 /libgfortran/libgfortran.h | |
parent | 52eb4ab4092228369cea5d7ca2717d32cc666c5c (diff) | |
download | gcc-e9bfdf18cb4f6fd6d323bc1a9008d2e717670ff7.zip gcc-e9bfdf18cb4f6fd6d323bc1a9008d2e717670ff7.tar.gz gcc-e9bfdf18cb4f6fd6d323bc1a9008d2e717670ff7.tar.bz2 |
libgfortran.h (GFC_ARRAY_DESCRIPTOR): Remove dimension of descriptor to use vaiable members for dim.
2018-02-12 Thomas Koenig <tkoenig@gcc.gnu.org>
* libgfortran.h (GFC_ARRAY_DESCRIPTOR): Remove dimension
of descriptor to use vaiable members for dim.
Change usage of GFC_ARRAY_DESCRIPTOR accordingly.
(GFC_FILL_ARRAY_DESCRIPTOR): New macro.
(gfc_full_array_i4): New type.
* intrinsics/date_and_time.c (secnds): Use sizeof
(gfc_array_i4) + sizeof (descriptor_dimension) for memory
allocation.
* intrinsics/reshape_generic.c: Use GFC_FULL_ARRAY_DESCRIPTOR.
* io/format.c: Use sizeof (gfc_array_i4) + sizeof
(descriptor_dimension) for memoy allocation.
* io/list_read.c (list_formatted_read_scalar): Use
gfc_full_array_i4 for variable.
(nml_read_obj): Likewise.
* io/write.c (list_formatted_write_scalar): Likewise.
(nml_write_obj): Likewise.
* m4/reshape.m4: Use GFC_FULL_ARRAY_DESCRIPTOR.
* generated/reshape_c10.c: Regenerated.
* generated/reshape_c16.c: Regenerated.
* generated/reshape_c4.c: Regenerated.
* generated/reshape_c8.c: Regenerated.
* generated/reshape_i16.c: Regenerated.
* generated/reshape_i4.c: Regenerated.
* generated/reshape_i8.c: Regenerated.
* generated/reshape_r10.c: Regenerated.
* generated/reshape_r16.c: Regenerated.
* generated/reshape_r4.c: Regenerated.
* generated/reshape_r8.c: Regenerated.
From-SVN: r257601
Diffstat (limited to 'libgfortran/libgfortran.h')
-rw-r--r-- | libgfortran/libgfortran.h | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 3b1dc72..38e364f 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -339,51 +339,65 @@ typedef struct dtype_type } dtype_type; -#define GFC_ARRAY_DESCRIPTOR(r, type) \ +#define GFC_ARRAY_DESCRIPTOR(type) \ struct {\ type *base_addr;\ size_t offset;\ dtype_type dtype;\ index_type span;\ - descriptor_dimension dim[r];\ + descriptor_dimension dim[];\ } /* Commonly used array descriptor types. */ -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) gfc_array_void; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, char) gfc_array_char; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_1) gfc_array_i1; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_2) gfc_array_i2; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_array_i4; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_8) gfc_array_i8; +typedef GFC_ARRAY_DESCRIPTOR (void) gfc_array_void; +typedef GFC_ARRAY_DESCRIPTOR (char) gfc_array_char; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_1) gfc_array_i1; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_2) gfc_array_i2; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_4) gfc_array_i4; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_8) gfc_array_i8; #ifdef HAVE_GFC_INTEGER_16 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_16) gfc_array_i16; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_16) gfc_array_i16; #endif -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_4) gfc_array_r4; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_8) gfc_array_r8; +typedef GFC_ARRAY_DESCRIPTOR (GFC_REAL_4) gfc_array_r4; +typedef GFC_ARRAY_DESCRIPTOR (GFC_REAL_8) gfc_array_r8; #ifdef HAVE_GFC_REAL_10 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_10) gfc_array_r10; +typedef GFC_ARRAY_DESCRIPTOR (GFC_REAL_10) gfc_array_r10; #endif #ifdef HAVE_GFC_REAL_16 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_16) gfc_array_r16; +typedef GFC_ARRAY_DESCRIPTOR (GFC_REAL_16) gfc_array_r16; #endif -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_4) gfc_array_c4; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_8) gfc_array_c8; +typedef GFC_ARRAY_DESCRIPTOR (GFC_COMPLEX_4) gfc_array_c4; +typedef GFC_ARRAY_DESCRIPTOR (GFC_COMPLEX_8) gfc_array_c8; #ifdef HAVE_GFC_COMPLEX_10 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_10) gfc_array_c10; +typedef GFC_ARRAY_DESCRIPTOR (GFC_COMPLEX_10) gfc_array_c10; #endif #ifdef HAVE_GFC_COMPLEX_16 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_16) gfc_array_c16; +typedef GFC_ARRAY_DESCRIPTOR (GFC_COMPLEX_16) gfc_array_c16; #endif -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_1) gfc_array_l1; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_2) gfc_array_l2; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_1) gfc_array_l1; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_2) gfc_array_l2; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_4) gfc_array_l4; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_8) gfc_array_l8; #ifdef HAVE_GFC_LOGICAL_16 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_16) gfc_array_l16; #endif typedef gfc_array_i1 gfc_array_s1; typedef gfc_array_i4 gfc_array_s4; +/* These are for when you actually want to declare a descriptor, as + opposed to a pointer to it. */ + +#define GFC_FULL_ARRAY_DESCRIPTOR(r, type) \ +struct {\ + type *base_addr;\ + size_t offset;\ + dtype_type dtype;\ + index_type span;\ + descriptor_dimension dim[r];\ +} + +typedef GFC_FULL_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_full_array_i4; + #define GFC_DESCRIPTOR_RANK(desc) ((desc)->dtype.rank) #define GFC_DESCRIPTOR_TYPE(desc) ((desc)->dtype.type) #define GFC_DESCRIPTOR_SIZE(desc) ((desc)->dtype.elem_len) @@ -1345,7 +1359,7 @@ iexport_proto(random_seed_i8); /* size.c */ -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) array_t; +typedef GFC_ARRAY_DESCRIPTOR (void) array_t; extern index_type size0 (const array_t * array); iexport_proto(size0); |