diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-14 18:37:11 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-14 18:37:11 +0000 |
commit | 7cd79676facfebe15f040912f35f048e6b0d0d89 (patch) | |
tree | 38a6a8e791d47a0e4f0ca6573ff2d1fefe65704a /libobjc | |
parent | 60a16309e63839d13efd95cd33f0731b14a5d589 (diff) | |
download | gcc-7cd79676facfebe15f040912f35f048e6b0d0d89.tar.gz |
2010-12-14 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 167801
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@167808 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r-- | libobjc/ChangeLog | 5 | ||||
-rw-r--r-- | libobjc/encoding.c | 48 |
2 files changed, 43 insertions, 10 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index fa609a58f86..81c790fc4cb 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,8 @@ +2010-12-13 Iain Sandoe <iains@gcc.gnu.org> + + * encoding.c (_darwin_rs6000_special_round_type_align): New. + (darwin_rs6000_special_round_type_align): Adjust to use new routine. + 2010-12-11 Nicola Pero <nicola.pero@meta-innovation.com> * sendmsg.c (selector_resolveClassMethod): New. diff --git a/libobjc/encoding.c b/libobjc/encoding.c index 13647d7d47c..92b7305d83e 100644 --- a/libobjc/encoding.c +++ b/libobjc/encoding.c @@ -117,27 +117,55 @@ static int __attribute__ ((__unused__)) not_target_flags = 0; to a static variable, initialized by target overrides. This is reset in linux64.h but not in darwin64.h. The macro is not used by *86*. */ -#if __MACH__ && __LP64__ -# undef TARGET_ALIGN_NATURAL -# define TARGET_ALIGN_NATURAL 1 +#if __MACH__ +# if __LP64__ +# undef TARGET_ALIGN_NATURAL +# define TARGET_ALIGN_NATURAL 1 +# endif + +/* On Darwin32, we need to recurse until we find the starting stuct type. */ +static int +_darwin_rs6000_special_round_type_align (const char *struc, int comp, int spec) +{ + const char *_stp , *_fields = TYPE_FIELDS (struc); + if (!_fields) + return MAX (comp, spec); + _stp = strip_array_types (_fields); + if (TYPE_MODE(_stp) == _C_COMPLEX) + _stp++; + switch (TYPE_MODE(_stp)) + { + case RECORD_TYPE: + case UNION_TYPE: + return MAX (MAX (comp, spec), objc_alignof_type (_stp) * BITS_PER_UNIT); + break; + case DFmode: + case _C_LNG_LNG: + case _C_ULNG_LNG: + return MAX (MAX (comp, spec), 64); + break; + + default: + return MAX (comp, spec); + break; + } +} + +/* See comment below. */ +#define darwin_rs6000_special_round_type_align(S,C,S2) \ + (_darwin_rs6000_special_round_type_align ((char*)(S), (int)(C), (int)(S2))) #endif /* FIXME: while this file has no business including tm.h, this definitely has no business defining this macro but it is only way around without really rewritting this file, - should look after the branch of 3.4 to fix this. - FIXME1: It's also out of date, darwin no longer has the same alignment - 'special' as aix - this is probably the origin of the m32 breakage. */ + should look after the branch of 3.4 to fix this. */ #define rs6000_special_round_type_align(STRUCT, COMPUTED, SPECIFIED) \ ({ const char *_fields = TYPE_FIELDS (STRUCT); \ ((_fields != 0 \ && TYPE_MODE (strip_array_types (TREE_TYPE (_fields))) == DFmode) \ ? MAX (MAX (COMPUTED, SPECIFIED), 64) \ : MAX (COMPUTED, SPECIFIED));}) -/* FIXME: The word 'fixme' is insufficient to explain the wrong-ness - of this next macro definition. */ -#define darwin_rs6000_special_round_type_align(S,C,S2) \ - rs6000_special_round_type_align(S,C,S2) /* Skip a variable name, enclosed in quotes ("). */ |