diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2005-12-12 05:47:52 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2005-12-11 21:47:52 -0800 |
commit | 761c0d29cba01652030743630ae66dd4d5c58946 (patch) | |
tree | cad2815889ab8ddb6c0aa7e2b53c6ff52d21b597 /libobjc | |
parent | 3897c0aae8cdd410c306f775e424fd32fd918257 (diff) | |
download | gcc-761c0d29cba01652030743630ae66dd4d5c58946.zip gcc-761c0d29cba01652030743630ae66dd4d5c58946.tar.gz gcc-761c0d29cba01652030743630ae66dd4d5c58946.tar.bz2 |
re PR libobjc/25354 (There should be an automated testsuite for objc_sizeof_type and objc_alignof_type)
2005-12-12 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/25354
* objc.dg/gnu-encoding: New directory.
* objc.dg/gnu-encoding/compat-common.h: New file.
* objc.dg/gnu-encoding/struct-layout-1.h: New file.
* objc.dg/gnu-encoding/struct-layout-1_test.h: New file.
* objc.dg/gnu-encoding/vector-defs.h: New file.
* objc.dg/gnu-encoding/gnu-encoding.exp: New file.
* objc.dg/gnu-encoding/generate-random.c: New file.
* objc.dg/gnu-encoding/generate-random_r.c: New file.
* objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: New file.
* objc.dg/gnu-encoding/generate-random.h: New file.
2005-12-12 Andrew Pinski <pinskia@physics.uc.edu>
* encoding.c (TYPE_FIELDS): Fix to skip over just _C_STRUCT_B and the name.
(get_inner_array_type): Fix to skip over _C_ARY_B and size.
(rs6000_special_round_type_align): Update for the ABI fix.
(objc_layout_finish_structure): Correct the encoding which is passed to
ROUND_TYPE_ALIGN.
From-SVN: r108398
Diffstat (limited to 'libobjc')
-rw-r--r-- | libobjc/ChangeLog | 9 | ||||
-rw-r--r-- | libobjc/encoding.c | 26 |
2 files changed, 28 insertions, 7 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index cb124aa..8273db8 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,12 @@ +2005-12-12 Andrew Pinski <pinskia@physics.uc.edu> + + * encoding.c (TYPE_FIELDS): Fix to skip over just _C_STRUCT_B and + the name. + (get_inner_array_type): Fix to skip over _C_ARY_B and size. + (rs6000_special_round_type_align): Update for the ABI fix. + (objc_layout_finish_structure): Correct the encoding which is passed to + ROUND_TYPE_ALIGN. + 2005-12-11 Andrew Pinski <pinskia@physics.uc.edu> PR libobjc/25347 diff --git a/libobjc/encoding.c b/libobjc/encoding.c index 1587c07..af6b93d 100644 --- a/libobjc/encoding.c +++ b/libobjc/encoding.c @@ -67,14 +67,24 @@ Boston, MA 02110-1301, USA. */ #define VECTOR_TYPE _C_VECTOR -#define TYPE_FIELDS(TYPE) objc_skip_typespec (TYPE) +#define TYPE_FIELDS(TYPE) ({const char *_field = (TYPE)+1; \ + while (*_field != _C_STRUCT_E && *_field != _C_STRUCT_B \ + && *_field != _C_UNION_B && *_field++ != '=') \ + /* do nothing */; \ + _field;}) #define DECL_MODE(TYPE) *(TYPE) #define TYPE_MODE(TYPE) *(TYPE) #define DFmode _C_DBL -#define get_inner_array_type(TYPE) ((TYPE) + 1) +#define get_inner_array_type(TYPE) ({const char *_field = (TYPE); \ + while (*_field == _C_ARY_B)\ + {\ + while (isdigit ((unsigned char)*++_field))\ + ;\ + }\ + _field;}) /* Some ports (eg ARM) allow the structure size boundary to be selected at compile-time. We override the normal definition with @@ -103,10 +113,13 @@ static int __attribute__ ((__unused__)) not_target_flags = 0; is only way around without really rewritting this file, should look after the branch of 3.4 to fix this. */ #define rs6000_special_round_type_align(STRUCT, COMPUTED, SPECIFIED) \ - ((TYPE_FIELDS (STRUCT) != 0 \ - && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode) \ + ({ const char *_fields = TYPE_FIELDS (STRUCT); \ + ((_fields != 0 \ + && TYPE_MODE (TREE_CODE (TREE_TYPE (_fields)) == ARRAY_TYPE \ + ? get_inner_array_type (_fields) \ + : TREE_TYPE (_fields)) == DFmode) \ ? MAX (MAX (COMPUTED, SPECIFIED), 64) \ - : MAX (COMPUTED, SPECIFIED)) + : MAX (COMPUTED, SPECIFIED));}) /* return the size of an object specified by type @@ -901,9 +914,8 @@ void objc_layout_finish_structure (struct objc_struct_layout *layout, /* Work out the alignment of the record as one expression and store in the record type. Round it up to a multiple of the record's alignment. */ - #if defined (ROUND_TYPE_ALIGN) && ! defined (__sparc__) - layout->record_align = ROUND_TYPE_ALIGN (layout->original_type, + layout->record_align = ROUND_TYPE_ALIGN (layout->original_type-1, 1, layout->record_align); #else |