diff options
author | obrien <obrien@FreeBSD.org> | 2002-05-09 22:50:04 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-05-09 22:50:04 +0000 |
commit | 9202658d3cd1b82b9c9b96c52fde1774d313ab2c (patch) | |
tree | ba6f9907191b31996edc00ff6dae7cf7978d19e9 /contrib/libobjc/encoding.c | |
parent | eb81e01d5162436a00b210305c91bbba234a0238 (diff) | |
download | FreeBSD-src-9202658d3cd1b82b9c9b96c52fde1774d313ab2c.zip FreeBSD-src-9202658d3cd1b82b9c9b96c52fde1774d313ab2c.tar.gz |
Gcc 3.1.0 pre-release's Objective C support bits from the FSF anoncvs repo
on 9-May-2002 15:57:15 EDT.
Diffstat (limited to 'contrib/libobjc/encoding.c')
-rw-r--r-- | contrib/libobjc/encoding.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/contrib/libobjc/encoding.c b/contrib/libobjc/encoding.c index 4749ba0..3927723 100644 --- a/contrib/libobjc/encoding.c +++ b/contrib/libobjc/encoding.c @@ -1,5 +1,5 @@ /* Encoding of types for Objective C. - Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. Contributed by Kresten Krab Thorup Bitfield support by Ovidiu Predescu @@ -30,14 +30,17 @@ Boston, MA 02111-1307, USA. */ #include "objc-api.h" #include "encoding.h" +#undef MAX #define MAX(X, Y) \ ({ typeof(X) __x = (X), __y = (Y); \ (__x > __y ? __x : __y); }) +#undef MIN #define MIN(X, Y) \ ({ typeof(X) __x = (X), __y = (Y); \ (__x < __y ? __x : __y); }) +#undef ROUND #define ROUND(V, A) \ ({ typeof(V) __v=(V); typeof(A) __a=(A); \ __a*((__v+__a-1)/__a); }) @@ -46,22 +49,37 @@ Boston, MA 02111-1307, USA. */ /* Various hacks for objc_layout_record. These are used by the target macros. */ -#define TREE_CODE(TYPE) *TYPE -#define TREE_TYPE(TREE) TREE +#define TREE_CODE(TYPE) *(TYPE) +#define TREE_TYPE(TREE) (TREE) #define RECORD_TYPE _C_STRUCT_B #define UNION_TYPE _C_UNION_B #define QUAL_UNION_TYPE _C_UNION_B #define ARRAY_TYPE _C_ARY_B +#define REAL_TYPE _C_DBL + +#define VECTOR_TYPE _C_VECTOR + #define TYPE_FIELDS(TYPE) objc_skip_typespec (TYPE) -#define DECL_MODE(TYPE) *(TYPE) +#define DECL_MODE(TYPE) *(TYPE) +#define TYPE_MODE(TYPE) *(TYPE) #define DFmode _C_DBL #define get_inner_array_type(TYPE) ((TYPE) + 1) +/* Some ports (eg ARM) allow the structure size boundary to be + selected at compile-time. We override the normal definition with + one that has a constant value for this compilation. */ +#undef STRUCTURE_SIZE_BOUNDARY +#define STRUCTURE_SIZE_BOUNDARY (BITS_PER_UNIT * sizeof (struct{char a;})) + +/* Some ROUND_TYPE_ALIGN macros use TARGET_foo, and consequently + target_flags. Define a dummy entry here to so we don't die. */ + +static int target_flags = 0; static inline int atoi (const char* str) @@ -724,9 +742,7 @@ objc_layout_structure (const char *type, layout->record_size = 0; layout->record_align = BITS_PER_UNIT; -#ifdef STRUCTURE_SIZE_BOUNDARY layout->record_align = MAX (layout->record_align, STRUCTURE_SIZE_BOUNDARY); -#endif } @@ -743,15 +759,6 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout) /* The current type without the type qualifiers */ const char *type; -#if 1 - if (layout->prev_type == NULL) - { - layout->prev_type = layout->type; - layout->type = objc_skip_typespec (layout->prev_type); - return YES; - } -#endif - /* Add the size of the previous field to the size of the record. */ if (layout->prev_type) { @@ -760,7 +767,6 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout) if (*type != _C_BFLD) layout->record_size += objc_sizeof_type (type) * BITS_PER_UNIT; else { - desired_align = 1; /* Get the bitfield's type */ for (bfld_type = type + 1; isdigit(*bfld_type); @@ -878,7 +884,7 @@ void objc_layout_finish_structure (struct objc_struct_layout *layout, in the record type. Round it up to a multiple of the record's alignment. */ -#ifdef ROUND_TYPE_ALIGN +#if defined(ROUND_TYPE_ALIGN) && !defined(__sparc__) layout->record_align = ROUND_TYPE_ALIGN (layout->original_type, 1, layout->record_align); |