Commit a153644f by Trevor Saunders Committed by Trevor Saunders

replace BITS_PER_UNIT with __CHAR_BIT__ in target libs

libgcc/ChangeLog:

2015-11-07  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* config/visium/lib2funcs.c (__set_trampoline_parity): Use
	__CHAR_BIT__ instead of BITS_PER_UNIT.
	* fixed-bit.h: Likewise.
	* fp-bit.h: Likewise.
	* libgcc2.c (__popcountSI2): Likewise.
	(__popcountDI2): Likewise.
	* libgcc2.h: Likewise.
	* libgcov.h: Likewise.

libobjc/ChangeLog:

2015-11-07  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	PR libobjc/24775
	* encoding.c (_darwin_rs6000_special_round_type_align): Use
	__CHAR_BIT__ instead of BITS_PER_UNIT.
	(objc_sizeof_type): Likewise.
	(objc_layout_structure): Likewise.
	(objc_layout_structure_next_member): Likewise.
	(objc_layout_finish_structure): Likewise.
	(objc_layout_structure_get_info): Likewise.

From-SVN: r229936
parent 3dee689d
2015-11-07 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* config/visium/lib2funcs.c (__set_trampoline_parity): Use
__CHAR_BIT__ instead of BITS_PER_UNIT.
* fixed-bit.h: Likewise.
* fp-bit.h: Likewise.
* libgcc2.c (__popcountSI2): Likewise.
(__popcountDI2): Likewise.
* libgcc2.h: Likewise.
* libgcov.h: Likewise.
2015-11-07 David Edelsohn <dje.gcc@gmail.com> 2015-11-07 David Edelsohn <dje.gcc@gmail.com>
* config/rs6000/atexit.c: New file. * config/rs6000/atexit.c: New file.
......
...@@ -315,7 +315,7 @@ __set_trampoline_parity (UWtype *addr) ...@@ -315,7 +315,7 @@ __set_trampoline_parity (UWtype *addr)
{ {
int i; int i;
for (i = 0; i < (TRAMPOLINE_SIZE * BITS_PER_UNIT) / W_TYPE_SIZE; i++) for (i = 0; i < (TRAMPOLINE_SIZE * __CHAR_BIT__) / W_TYPE_SIZE; i++)
addr[i] |= parity_bit (addr[i]); addr[i] |= parity_bit (addr[i]);
} }
#endif #endif
......
...@@ -434,7 +434,7 @@ typedef union ...@@ -434,7 +434,7 @@ typedef union
} INTunion; } INTunion;
#endif #endif
#define FIXED_WIDTH (FIXED_SIZE * BITS_PER_UNIT) /* in bits. */ #define FIXED_WIDTH (FIXED_SIZE * __CHAR_BIT__) /* in bits. */
#define FIXED_C_TYPE1(NAME) NAME ## type #define FIXED_C_TYPE1(NAME) NAME ## type
#define FIXED_C_TYPE2(NAME) FIXED_C_TYPE1(NAME) #define FIXED_C_TYPE2(NAME) FIXED_C_TYPE1(NAME)
#define FIXED_C_TYPE FIXED_C_TYPE2(MODE_NAME) #define FIXED_C_TYPE FIXED_C_TYPE2(MODE_NAME)
...@@ -1108,17 +1108,17 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, word_type); ...@@ -1108,17 +1108,17 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, word_type);
#if defined (FROM_MODE_NAME_S) && defined (TO_MODE_NAME_S) #if defined (FROM_MODE_NAME_S) && defined (TO_MODE_NAME_S)
#if FROM_TYPE == 1 /* Signed integer. */ #if FROM_TYPE == 1 /* Signed integer. */
#define FROM_INT_WIDTH (FROM_INT_SIZE * BITS_PER_UNIT) #define FROM_INT_WIDTH (FROM_INT_SIZE * __CHAR_BIT__)
#endif #endif
#if FROM_TYPE == 2 /* Unsigned integer. */ #if FROM_TYPE == 2 /* Unsigned integer. */
#define FROM_INT_WIDTH (FROM_INT_SIZE * BITS_PER_UNIT) #define FROM_INT_WIDTH (FROM_INT_SIZE * __CHAR_BIT__)
#endif #endif
#if FROM_TYPE == 4 /* Fixed-point. */ #if FROM_TYPE == 4 /* Fixed-point. */
#define FROM_FIXED_C_TYPE FIXED_C_TYPE2(FROM_MODE_NAME) #define FROM_FIXED_C_TYPE FIXED_C_TYPE2(FROM_MODE_NAME)
#define FROM_FBITS FBITS2(FROM_MODE_NAME) #define FROM_FBITS FBITS2(FROM_MODE_NAME)
#define FROM_FIXED_WIDTH (FROM_FIXED_SIZE * BITS_PER_UNIT) #define FROM_FIXED_WIDTH (FROM_FIXED_SIZE * __CHAR_BIT__)
#define FROM_FBITS FBITS2(FROM_MODE_NAME) #define FROM_FBITS FBITS2(FROM_MODE_NAME)
#define FROM_IBITS IBITS2(FROM_MODE_NAME) #define FROM_IBITS IBITS2(FROM_MODE_NAME)
#define FROM_I_F_BITS (FROM_FBITS + FROM_IBITS) #define FROM_I_F_BITS (FROM_FBITS + FROM_IBITS)
...@@ -1136,7 +1136,7 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, word_type); ...@@ -1136,7 +1136,7 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, word_type);
#if TO_TYPE == 4 /* Fixed-point. */ #if TO_TYPE == 4 /* Fixed-point. */
#define TO_FIXED_C_TYPE FIXED_C_TYPE2(TO_MODE_NAME) #define TO_FIXED_C_TYPE FIXED_C_TYPE2(TO_MODE_NAME)
#define TO_FBITS FBITS2(TO_MODE_NAME) #define TO_FBITS FBITS2(TO_MODE_NAME)
#define TO_FIXED_WIDTH (TO_FIXED_SIZE * BITS_PER_UNIT) #define TO_FIXED_WIDTH (TO_FIXED_SIZE * __CHAR_BIT__)
#define TO_FBITS FBITS2(TO_MODE_NAME) #define TO_FBITS FBITS2(TO_MODE_NAME)
#define TO_IBITS IBITS2(TO_MODE_NAME) #define TO_IBITS IBITS2(TO_MODE_NAME)
#define TO_I_F_BITS (TO_FBITS + TO_IBITS) #define TO_I_F_BITS (TO_FBITS + TO_IBITS)
......
...@@ -117,11 +117,11 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); ...@@ -117,11 +117,11 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
#define MAX_USI_INT (~(USItype)0) #define MAX_USI_INT (~(USItype)0)
#define MAX_SI_INT ((SItype) (MAX_USI_INT >> 1)) #define MAX_SI_INT ((SItype) (MAX_USI_INT >> 1))
#define BITS_PER_SI (4 * BITS_PER_UNIT) #define BITS_PER_SI (4 * __CHAR_BIT__)
#ifdef TMODES #ifdef TMODES
#define MAX_UDI_INT (~(UDItype)0) #define MAX_UDI_INT (~(UDItype)0)
#define MAX_DI_INT ((DItype) (MAX_UDI_INT >> 1)) #define MAX_DI_INT ((DItype) (MAX_UDI_INT >> 1))
#define BITS_PER_DI (8 * BITS_PER_UNIT) #define BITS_PER_DI (8 * __CHAR_BIT__)
#endif #endif
#ifdef FLOAT_ONLY #ifdef FLOAT_ONLY
......
...@@ -160,7 +160,7 @@ __mulvSI3 (Wtype a, Wtype b) ...@@ -160,7 +160,7 @@ __mulvSI3 (Wtype a, Wtype b)
} }
#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC #ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
#undef WORD_SIZE #undef WORD_SIZE
#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT) #define WORD_SIZE (sizeof (SItype) * __CHAR_BIT__)
SItype SItype
__mulvsi3 (SItype a, SItype b) __mulvsi3 (SItype a, SItype b)
{ {
...@@ -820,16 +820,16 @@ const UQItype __popcount_tab[256] = ...@@ -820,16 +820,16 @@ const UQItype __popcount_tab[256] =
#endif #endif
#if defined(L_popcountsi2) || defined(L_popcountdi2) #if defined(L_popcountsi2) || defined(L_popcountdi2)
#define POPCOUNTCST2(x) (((UWtype) x << BITS_PER_UNIT) | x) #define POPCOUNTCST2(x) (((UWtype) x << __CHAR_BIT__) | x)
#define POPCOUNTCST4(x) (((UWtype) x << (2 * BITS_PER_UNIT)) | x) #define POPCOUNTCST4(x) (((UWtype) x << (2 * __CHAR_BIT__)) | x)
#define POPCOUNTCST8(x) (((UWtype) x << (4 * BITS_PER_UNIT)) | x) #define POPCOUNTCST8(x) (((UWtype) x << (4 * __CHAR_BIT__)) | x)
#if W_TYPE_SIZE == BITS_PER_UNIT #if W_TYPE_SIZE == __CHAR_BIT__
#define POPCOUNTCST(x) x #define POPCOUNTCST(x) x
#elif W_TYPE_SIZE == 2 * BITS_PER_UNIT #elif W_TYPE_SIZE == 2 * __CHAR_BIT__
#define POPCOUNTCST(x) POPCOUNTCST2 (x) #define POPCOUNTCST(x) POPCOUNTCST2 (x)
#elif W_TYPE_SIZE == 4 * BITS_PER_UNIT #elif W_TYPE_SIZE == 4 * __CHAR_BIT__
#define POPCOUNTCST(x) POPCOUNTCST4 (POPCOUNTCST2 (x)) #define POPCOUNTCST(x) POPCOUNTCST4 (POPCOUNTCST2 (x))
#elif W_TYPE_SIZE == 8 * BITS_PER_UNIT #elif W_TYPE_SIZE == 8 * __CHAR_BIT__
#define POPCOUNTCST(x) POPCOUNTCST8 (POPCOUNTCST4 (POPCOUNTCST2 (x))) #define POPCOUNTCST(x) POPCOUNTCST8 (POPCOUNTCST4 (POPCOUNTCST2 (x)))
#endif #endif
#endif #endif
...@@ -842,11 +842,11 @@ __popcountSI2 (UWtype x) ...@@ -842,11 +842,11 @@ __popcountSI2 (UWtype x)
/* Force table lookup on targets like AVR and RL78 which only /* Force table lookup on targets like AVR and RL78 which only
pretend they have LIBGCC2_UNITS_PER_WORD 4, but actually pretend they have LIBGCC2_UNITS_PER_WORD 4, but actually
have 1, and other small word targets. */ have 1, and other small word targets. */
#if __SIZEOF_INT__ > 2 && defined (POPCOUNTCST) && BITS_PER_UNIT == 8 #if __SIZEOF_INT__ > 2 && defined (POPCOUNTCST) && __CHAR_BIT__ == 8
x = x - ((x >> 1) & POPCOUNTCST (0x55)); x = x - ((x >> 1) & POPCOUNTCST (0x55));
x = (x & POPCOUNTCST (0x33)) + ((x >> 2) & POPCOUNTCST (0x33)); x = (x & POPCOUNTCST (0x33)) + ((x >> 2) & POPCOUNTCST (0x33));
x = (x + (x >> 4)) & POPCOUNTCST (0x0F); x = (x + (x >> 4)) & POPCOUNTCST (0x0F);
return (x * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - BITS_PER_UNIT); return (x * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - __CHAR_BIT__);
#else #else
int i, ret = 0; int i, ret = 0;
...@@ -866,7 +866,7 @@ __popcountDI2 (UDWtype x) ...@@ -866,7 +866,7 @@ __popcountDI2 (UDWtype x)
/* Force table lookup on targets like AVR and RL78 which only /* Force table lookup on targets like AVR and RL78 which only
pretend they have LIBGCC2_UNITS_PER_WORD 4, but actually pretend they have LIBGCC2_UNITS_PER_WORD 4, but actually
have 1, and other small word targets. */ have 1, and other small word targets. */
#if __SIZEOF_INT__ > 2 && defined (POPCOUNTCST) && BITS_PER_UNIT == 8 #if __SIZEOF_INT__ > 2 && defined (POPCOUNTCST) && __CHAR_BIT__ == 8
const DWunion uu = {.ll = x}; const DWunion uu = {.ll = x};
UWtype x1 = uu.s.low, x2 = uu.s.high; UWtype x1 = uu.s.low, x2 = uu.s.high;
x1 = x1 - ((x1 >> 1) & POPCOUNTCST (0x55)); x1 = x1 - ((x1 >> 1) & POPCOUNTCST (0x55));
...@@ -876,7 +876,7 @@ __popcountDI2 (UDWtype x) ...@@ -876,7 +876,7 @@ __popcountDI2 (UDWtype x)
x1 = (x1 + (x1 >> 4)) & POPCOUNTCST (0x0F); x1 = (x1 + (x1 >> 4)) & POPCOUNTCST (0x0F);
x2 = (x2 + (x2 >> 4)) & POPCOUNTCST (0x0F); x2 = (x2 + (x2 >> 4)) & POPCOUNTCST (0x0F);
x1 += x2; x1 += x2;
return (x1 * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - BITS_PER_UNIT); return (x1 * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - __CHAR_BIT__);
#else #else
int i, ret = 0; int i, ret = 0;
......
...@@ -178,7 +178,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__))); ...@@ -178,7 +178,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
if it existed. */ if it existed. */
#if LIBGCC2_UNITS_PER_WORD == 8 #if LIBGCC2_UNITS_PER_WORD == 8
#define W_TYPE_SIZE (8 * BITS_PER_UNIT) #define W_TYPE_SIZE (8 * __CHAR_BIT__)
#define Wtype DItype #define Wtype DItype
#define UWtype UDItype #define UWtype UDItype
#define HWtype DItype #define HWtype DItype
...@@ -194,7 +194,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__))); ...@@ -194,7 +194,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
#endif #endif
#define COMPAT_SIMODE_TRAPPING_ARITHMETIC #define COMPAT_SIMODE_TRAPPING_ARITHMETIC
#elif LIBGCC2_UNITS_PER_WORD == 4 #elif LIBGCC2_UNITS_PER_WORD == 4
#define W_TYPE_SIZE (4 * BITS_PER_UNIT) #define W_TYPE_SIZE (4 * __CHAR_BIT__)
#define Wtype SItype #define Wtype SItype
#define UWtype USItype #define UWtype USItype
#define HWtype SItype #define HWtype SItype
...@@ -209,7 +209,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__))); ...@@ -209,7 +209,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
#define __NDW(a,b) __ ## a ## di ## b #define __NDW(a,b) __ ## a ## di ## b
#endif #endif
#elif LIBGCC2_UNITS_PER_WORD == 2 #elif LIBGCC2_UNITS_PER_WORD == 2
#define W_TYPE_SIZE (2 * BITS_PER_UNIT) #define W_TYPE_SIZE (2 * __CHAR_BIT__)
#define Wtype HItype #define Wtype HItype
#define UWtype UHItype #define UWtype UHItype
#define HWtype HItype #define HWtype HItype
...@@ -224,7 +224,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__))); ...@@ -224,7 +224,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
#define __NDW(a,b) __ ## a ## si ## b #define __NDW(a,b) __ ## a ## si ## b
#endif #endif
#else #else
#define W_TYPE_SIZE BITS_PER_UNIT #define W_TYPE_SIZE __CHAR_BIT__
#define Wtype QItype #define Wtype QItype
#define UWtype UQItype #define UWtype UQItype
#define HWtype QItype #define HWtype QItype
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "tm.h" #include "tm.h"
#include "libgcc_tm.h" #include "libgcc_tm.h"
#if BITS_PER_UNIT == 8 #if __CHAR_BIT__ == 8
typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI))); typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
typedef unsigned gcov_position_t __attribute__ ((mode (SI))); typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
#if LONG_LONG_TYPE_SIZE > 32 #if LONG_LONG_TYPE_SIZE > 32
...@@ -54,7 +54,7 @@ typedef signed gcov_type __attribute__ ((mode (SI))); ...@@ -54,7 +54,7 @@ typedef signed gcov_type __attribute__ ((mode (SI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI))); typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
#endif #endif
#else #else
#if BITS_PER_UNIT == 16 #if __CHAR_BIT__ == 16
typedef unsigned gcov_unsigned_t __attribute__ ((mode (HI))); typedef unsigned gcov_unsigned_t __attribute__ ((mode (HI)));
typedef unsigned gcov_position_t __attribute__ ((mode (HI))); typedef unsigned gcov_position_t __attribute__ ((mode (HI)));
#if LONG_LONG_TYPE_SIZE > 32 #if LONG_LONG_TYPE_SIZE > 32
......
2015-11-07 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
PR libobjc/24775
* encoding.c (_darwin_rs6000_special_round_type_align): Use
__CHAR_BIT__ instead of BITS_PER_UNIT.
(objc_sizeof_type): Likewise.
(objc_layout_structure): Likewise.
(objc_layout_structure_next_member): Likewise.
(objc_layout_finish_structure): Likewise.
(objc_layout_structure_get_info): Likewise.
2015-11-03 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> 2015-11-03 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
PR libobjc/24775 PR libobjc/24775
......
...@@ -94,11 +94,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -94,11 +94,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Some ports (eg ARM) allow the structure size boundary to be /* Some ports (eg ARM) allow the structure size boundary to be
selected at compile-time. We override the normal definition with selected at compile-time. We override the normal definition with
one that has a constant value for this compilation. */ one that has a constant value for this compilation. */
#ifndef BITS_PER_UNIT
#define BITS_PER_UNIT 8
#endif
#undef STRUCTURE_SIZE_BOUNDARY #undef STRUCTURE_SIZE_BOUNDARY
#define STRUCTURE_SIZE_BOUNDARY (BITS_PER_UNIT * sizeof (struct{char a;})) #define STRUCTURE_SIZE_BOUNDARY (__CHAR_BIT__ * sizeof (struct{char a;}))
/* Some ROUND_TYPE_ALIGN macros use TARGET_foo, and consequently /* Some ROUND_TYPE_ALIGN macros use TARGET_foo, and consequently
target_flags. Define a dummy entry here to so we don't die. target_flags. Define a dummy entry here to so we don't die.
...@@ -163,7 +160,7 @@ _darwin_rs6000_special_round_type_align (const char *struc, int comp, int spec) ...@@ -163,7 +160,7 @@ _darwin_rs6000_special_round_type_align (const char *struc, int comp, int spec)
{ {
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
return MAX (MAX (comp, spec), objc_alignof_type (_stp) * BITS_PER_UNIT); return MAX (MAX (comp, spec), objc_alignof_type (_stp) * __CHAR_BIT__);
break; break;
case DFmode: case DFmode:
case _C_LNG_LNG: case _C_LNG_LNG:
...@@ -335,8 +332,8 @@ objc_sizeof_type (const char *type) ...@@ -335,8 +332,8 @@ objc_sizeof_type (const char *type)
; ;
size = atoi (type + 1); size = atoi (type + 1);
startByte = position / BITS_PER_UNIT; startByte = position / __CHAR_BIT__;
endByte = (position + size) / BITS_PER_UNIT; endByte = (position + size) / __CHAR_BIT__;
return endByte - startByte; return endByte - startByte;
} }
...@@ -1093,7 +1090,7 @@ objc_layout_structure (const char *type, ...@@ -1093,7 +1090,7 @@ objc_layout_structure (const char *type,
layout->type = type; layout->type = type;
layout->prev_type = NULL; layout->prev_type = NULL;
layout->record_size = 0; layout->record_size = 0;
layout->record_align = BITS_PER_UNIT; layout->record_align = __CHAR_BIT__;
layout->record_align = MAX (layout->record_align, STRUCTURE_SIZE_BOUNDARY); layout->record_align = MAX (layout->record_align, STRUCTURE_SIZE_BOUNDARY);
} }
...@@ -1117,10 +1114,10 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout) ...@@ -1117,10 +1114,10 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
type = objc_skip_type_qualifiers (layout->prev_type); type = objc_skip_type_qualifiers (layout->prev_type);
if (unionp) if (unionp)
layout->record_size = MAX (layout->record_size, layout->record_size = MAX (layout->record_size,
objc_sizeof_type (type) * BITS_PER_UNIT); objc_sizeof_type (type) * __CHAR_BIT__);
else if (*type != _C_BFLD) else if (*type != _C_BFLD)
layout->record_size += objc_sizeof_type (type) * BITS_PER_UNIT; layout->record_size += objc_sizeof_type (type) * __CHAR_BIT__;
else { else {
/* Get the bitfield's type */ /* Get the bitfield's type */
for (bfld_type = type + 1; for (bfld_type = type + 1;
...@@ -1128,7 +1125,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout) ...@@ -1128,7 +1125,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
bfld_type++) bfld_type++)
/* do nothing */; /* do nothing */;
bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; bfld_type_align = objc_alignof_type (bfld_type) * __CHAR_BIT__;
bfld_field_size = atoi (objc_skip_typespec (bfld_type)); bfld_field_size = atoi (objc_skip_typespec (bfld_type));
layout->record_size += bfld_field_size; layout->record_size += bfld_field_size;
} }
...@@ -1143,7 +1140,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout) ...@@ -1143,7 +1140,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
type = objc_skip_type_qualifiers (layout->type); type = objc_skip_type_qualifiers (layout->type);
if (*type != _C_BFLD) if (*type != _C_BFLD)
desired_align = objc_alignof_type (type) * BITS_PER_UNIT; desired_align = objc_alignof_type (type) * __CHAR_BIT__;
else else
{ {
desired_align = 1; desired_align = 1;
...@@ -1153,7 +1150,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout) ...@@ -1153,7 +1150,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
bfld_type++) bfld_type++)
/* do nothing */; /* do nothing */;
bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; bfld_type_align = objc_alignof_type (bfld_type) * __CHAR_BIT__;
bfld_field_size = atoi (objc_skip_typespec (bfld_type)); bfld_field_size = atoi (objc_skip_typespec (bfld_type));
} }
...@@ -1180,7 +1177,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout) ...@@ -1180,7 +1177,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
if (bfld_field_size) if (bfld_field_size)
layout->record_align = MAX (layout->record_align, desired_align); layout->record_align = MAX (layout->record_align, desired_align);
else else
desired_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; desired_align = objc_alignof_type (bfld_type) * __CHAR_BIT__;
/* A named bit field of declared type `int' /* A named bit field of declared type `int'
forces the entire structure to have `int' alignment. forces the entire structure to have `int' alignment.
...@@ -1194,7 +1191,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout) ...@@ -1194,7 +1191,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
if (maximum_field_alignment != 0) if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment); type_align = MIN (type_align, maximum_field_alignment);
else if (DECL_PACKED (field)) else if (DECL_PACKED (field))
type_align = MIN (type_align, BITS_PER_UNIT); type_align = MIN (type_align, __CHAR_BIT__);
#endif #endif
layout->record_align = MAX (layout->record_align, type_align); layout->record_align = MAX (layout->record_align, type_align);
...@@ -1251,9 +1248,9 @@ void objc_layout_finish_structure (struct objc_struct_layout *layout, ...@@ -1251,9 +1248,9 @@ void objc_layout_finish_structure (struct objc_struct_layout *layout,
layout->type = NULL; layout->type = NULL;
} }
if (size) if (size)
*size = layout->record_size / BITS_PER_UNIT; *size = layout->record_size / __CHAR_BIT__;
if (align) if (align)
*align = layout->record_align / BITS_PER_UNIT; *align = layout->record_align / __CHAR_BIT__;
} }
void objc_layout_structure_get_info (struct objc_struct_layout *layout, void objc_layout_structure_get_info (struct objc_struct_layout *layout,
...@@ -1262,9 +1259,9 @@ void objc_layout_structure_get_info (struct objc_struct_layout *layout, ...@@ -1262,9 +1259,9 @@ void objc_layout_structure_get_info (struct objc_struct_layout *layout,
const char **type) const char **type)
{ {
if (offset) if (offset)
*offset = layout->record_size / BITS_PER_UNIT; *offset = layout->record_size / __CHAR_BIT__;
if (align) if (align)
*align = layout->record_align / BITS_PER_UNIT; *align = layout->record_align / __CHAR_BIT__;
if (type) if (type)
*type = layout->prev_type; *type = layout->prev_type;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment