diff mbox

use __SIZEOF_DOUBLE__ in libgcc

Message ID 20101011232443.GU24720@nightcrawler
State New
Headers show

Commit Message

Nathan Froyd Oct. 11, 2010, 11:24 p.m. UTC
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.

New patch, this time using __SIZEOF_DOUBLE__ * __CHAR_BIT__ as Jakub
suggested and changing tm.texi to use DOUBLE_TYPE_SIZE instead of
LIBGCC2_DOUBLE_TYPE_SIZE as Joseph suggested.

Tested as before.  OK to commit?

-Nathan

	* 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.
	* doc/tm.texi.in (LIBGCC2_HAS_DF_MODE): Use DOUBLE_TYPE_SIZE.
	(DF_SIZE): Likewise.
	* doc/tm.texi: Regenerate.

Comments

Mark Mitchell Oct. 12, 2010, 6:02 p.m. UTC | #1
On 10/11/2010 4:24 PM, Nathan Froyd wrote:

> 	* 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.
> 	* doc/tm.texi.in (LIBGCC2_HAS_DF_MODE): Use DOUBLE_TYPE_SIZE.
> 	(DF_SIZE): Likewise.
> 	* doc/tm.texi: Regenerate.

OK.
diff mbox

Patch

diff --git a/gcc/config/fixed-bit.h b/gcc/config/fixed-bit.h
index 0ee8af3..ce5b96e 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__ * __CHAR_BIT__ == 64 \
        || 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/doc/tm.texi b/gcc/doc/tm.texi
index faa7250..f2a4d7c 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -1624,10 +1624,10 @@  default is @code{LONG_DOUBLE_TYPE_SIZE}.
 @end defmac
 
 @defmac LIBGCC2_HAS_DF_MODE
-Define this macro if neither @code{LIBGCC2_DOUBLE_TYPE_SIZE} nor
+Define this macro if neither @code{DOUBLE_TYPE_SIZE} nor
 @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is
 @code{DFmode} but you want @code{DFmode} routines in @file{libgcc2.a}
-anyway.  If you don't define this and either @code{LIBGCC2_DOUBLE_TYPE_SIZE}
+anyway.  If you don't define this and either @code{DOUBLE_TYPE_SIZE}
 or @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64 then the default is 1,
 otherwise it is 0.
 @end defmac
@@ -1656,7 +1656,7 @@  if the defaults in @file{libgcc2.h} are inappropriate.  By default,
 @code{FLT_MANT_DIG} is used for @code{SF_SIZE}, @code{LDBL_MANT_DIG}
 for @code{XF_SIZE} and @code{TF_SIZE}, and @code{DBL_MANT_DIG} or
 @code{LDBL_MANT_DIG} for @code{DF_SIZE} according to whether
-@code{LIBGCC2_DOUBLE_TYPE_SIZE} or
+@code{DOUBLE_TYPE_SIZE} or
 @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64.
 @end defmac
 
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index cdd9a22..731cf21 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -1624,10 +1624,10 @@  default is @code{LONG_DOUBLE_TYPE_SIZE}.
 @end defmac
 
 @defmac LIBGCC2_HAS_DF_MODE
-Define this macro if neither @code{LIBGCC2_DOUBLE_TYPE_SIZE} nor
+Define this macro if neither @code{DOUBLE_TYPE_SIZE} nor
 @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is
 @code{DFmode} but you want @code{DFmode} routines in @file{libgcc2.a}
-anyway.  If you don't define this and either @code{LIBGCC2_DOUBLE_TYPE_SIZE}
+anyway.  If you don't define this and either @code{DOUBLE_TYPE_SIZE}
 or @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64 then the default is 1,
 otherwise it is 0.
 @end defmac
@@ -1656,7 +1656,7 @@  if the defaults in @file{libgcc2.h} are inappropriate.  By default,
 @code{FLT_MANT_DIG} is used for @code{SF_SIZE}, @code{LDBL_MANT_DIG}
 for @code{XF_SIZE} and @code{TF_SIZE}, and @code{DBL_MANT_DIG} or
 @code{LDBL_MANT_DIG} for @code{DF_SIZE} according to whether
-@code{LIBGCC2_DOUBLE_TYPE_SIZE} or
+@code{DOUBLE_TYPE_SIZE} or
 @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64.
 @end defmac
 
diff --git a/gcc/libgcc2.h b/gcc/libgcc2.h
index f344917..d2d86ef 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__ * __CHAR_BIT__ == 64 \
        || 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__ * __CHAR_BIT__ == 64
 #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