Message ID | 20101011005633.GA24720@nightcrawler |
---|---|
State | New |
Headers | show |
On Sun, Oct 10, 2010 at 08:56:34PM -0400, Nathan Froyd wrote: > The patch below removes LIBGCC2_DOUBLE_TYPE_SIZE from libgcc.2h and > related files, replacing it instead with __SIZEOF_DOUBLE__ (and > adjusting conditionals to account for the bits/bytes mismatch). One > less use of target macros in libgcc is a good thing. Are you sure this (and your previos __SIZEOF_LONG*__ patch) won't break __CHAR_BIT__ > 8 targets, because you assume in your calculations 8 bit char? The old code could be wrong, but if it is not, wouldn't it be better to replace those macros with bitsizes with __SIZEOF_*__ * __CHAR_BIT__ instead of __SIZEOF_*__ alone and dividing expected sizes by 8? > * libgcc2.h: Use __SIZEOF_DOUBLE__ instead of > LIBGCC2_DOUBLE_TYPE_SIZE. > (LIBGCC2_DOUBLE_TYPE_SIZE): Delete. > * config/fixed-bit.h: Likewise. > * config/rx/rx.h (LIBGCC2_DOUBLE_TYPE_SIZE): Delete. > * config/sh/sh.h (LIBGCC2_DOUBLE_TYPE_SIZE): Delete. > * system.h (LIBGCC2_DOUBLE_TYPE_SIZE): Poison. Jakub
On Sun, 10 Oct 2010, Nathan Froyd wrote: > The patch below removes LIBGCC2_DOUBLE_TYPE_SIZE from libgcc.2h and > related files, replacing it instead with __SIZEOF_DOUBLE__ (and > adjusting conditionals to account for the bits/bytes mismatch). One > less use of target macros in libgcc is a good thing. You appear to be missing the changes to tm.texi.in/tm.texi to remove references to the old LIBGCC2_DOUBLE_TYPE_SIZE macro.
On Mon, Oct 11, 2010 at 03:14:19PM +0200, Jakub Jelinek wrote: > On Sun, Oct 10, 2010 at 08:56:34PM -0400, Nathan Froyd wrote: > > The patch below removes LIBGCC2_DOUBLE_TYPE_SIZE from libgcc.2h and > > related files, replacing it instead with __SIZEOF_DOUBLE__ (and > > adjusting conditionals to account for the bits/bytes mismatch). One > > less use of target macros in libgcc is a good thing. > > Are you sure this (and your previos __SIZEOF_LONG*__ patch) won't break > __CHAR_BIT__ > 8 targets, because you assume in your calculations > 8 bit char? > The old code could be wrong, but if it is not, wouldn't it be better > to replace those macros with bitsizes with __SIZEOF_*__ * __CHAR_BIT__ > instead of __SIZEOF_*__ alone and dividing expected sizes by 8? Oof. On the one hand, AFAICS, there are no such targets in the tree, and the standard response to people asking about ports to such targets is, "well, theoretically you can do it, but there might be a lot of fallout." So I'm not particularly inclined to keep things in order for out-of-tree targets or hypothetical future ports. OTOH, avoiding obvious breakage is pretty easy. And I need to update for tm.texi anyway, as Joseph pointed out. I'll submit an updated patch for this, and a separate patch for the __SIZEOF_LONG__ issue. -Nathan
diff --git a/gcc/config/fixed-bit.h b/gcc/config/fixed-bit.h index 0ee8af3..ad75efd 100644 --- a/gcc/config/fixed-bit.h +++ b/gcc/config/fixed-bit.h @@ -49,9 +49,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN #endif -#ifndef LIBGCC2_DOUBLE_TYPE_SIZE -#define LIBGCC2_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE -#endif #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE #endif @@ -63,7 +60,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #ifndef LIBGCC2_HAS_DF_MODE #define LIBGCC2_HAS_DF_MODE \ (BITS_PER_UNIT == 8 \ - && (LIBGCC2_DOUBLE_TYPE_SIZE == 64 \ + && (__SIZEOF_DOUBLE__ == 8 \ || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64)) #endif diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h index 140d6d4..7da4de1 100644 --- a/gcc/config/rx/rx.h +++ b/gcc/config/rx/rx.h @@ -115,11 +115,9 @@ extern enum rx_cpu_types rx_cpu_type; #ifdef __RX_32BIT_DOUBLES__ #define LIBGCC2_HAS_DF_MODE 0 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 32 -#define LIBGCC2_DOUBLE_TYPE_SIZE 32 #else #define LIBGCC2_HAS_DF_MODE 1 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#define LIBGCC2_DOUBLE_TYPE_SIZE 64 #endif #define DEFAULT_SIGNED_CHAR 0 diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 01236c1..8f149dc 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2028,12 +2028,6 @@ struct sh_args { floating point types equivalent to `float'. */ #define DOUBLE_TYPE_SIZE ((TARGET_SH2E && ! TARGET_SH4 && ! TARGET_SH2A_DOUBLE) ? 32 : 64) -#if defined(__SH2E__) || defined(__SH3E__) || defined( __SH2A_SINGLE_ONLY__) || defined( __SH4_SINGLE_ONLY__) -#define LIBGCC2_DOUBLE_TYPE_SIZE 32 -#else -#define LIBGCC2_DOUBLE_TYPE_SIZE 64 -#endif - /* 'char' is signed by default. */ #define DEFAULT_SIGNED_CHAR 1 diff --git a/gcc/libgcc2.h b/gcc/libgcc2.h index f344917..1c61dbc 100644 --- a/gcc/libgcc2.h +++ b/gcc/libgcc2.h @@ -43,9 +43,6 @@ extern void __eprintf (const char *, const char *, unsigned int, const char *) #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN #endif -#ifndef LIBGCC2_DOUBLE_TYPE_SIZE -#define LIBGCC2_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE -#endif #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE #endif @@ -57,7 +54,7 @@ extern void __eprintf (const char *, const char *, unsigned int, const char *) #ifndef LIBGCC2_HAS_DF_MODE #define LIBGCC2_HAS_DF_MODE \ (BITS_PER_UNIT == 8 \ - && (LIBGCC2_DOUBLE_TYPE_SIZE == 64 \ + && (__SIZEOF_DOUBLE__ == 8 \ || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64)) #endif @@ -81,7 +78,7 @@ extern void __eprintf (const char *, const char *, unsigned int, const char *) #ifndef DF_SIZE #if LIBGCC2_HAS_DF_MODE -#if LIBGCC2_DOUBLE_TYPE_SIZE == 64 +#if __SIZEOF_DOUBLE__ == 8 #define DF_SIZE DBL_MANT_DIG #elif LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64 #define DF_SIZE LDBL_MANT_DIG diff --git a/gcc/system.h b/gcc/system.h index 4bfebaf..5131fed 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -784,6 +784,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; TARGET_PROMOTE_FUNCTION_ARGS TARGET_PROMOTE_FUNCTION_RETURN \ LANG_HOOKS_MISSING_ARGUMENT LANG_HOOKS_HASH_TYPES +/* Hooks into libgcc2. */ + #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE + /* Miscellaneous macros that are no longer used. */ #pragma GCC poison USE_MAPPED_LOCATION