summaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-12 05:47:52 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-12 05:47:52 +0000
commit2be744b21e671424b77eefe2634867ed254a908e (patch)
treecad2815889ab8ddb6c0aa7e2b53c6ff52d21b597 /libobjc
parentd023a9aa2a9694def829db7e6ec7cacb627e4106 (diff)
downloadgcc-2be744b21e671424b77eefe2634867ed254a908e.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108398 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/ChangeLog9
-rw-r--r--libobjc/encoding.c26
2 files changed, 28 insertions, 7 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index cb124aa3a18..8273db801ef 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 1587c072214..af6b93d4498 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