#ifdef maze logic error in real.h

David O'Brien obrien@FreeBSD.org
Fri Dec 7 17:32:00 GMT 2001


I keep reading real.h (trying to fix some warnings in a target I am
working on).  And for the life of me I cannot see how the #else part of
the 'software floating point emulator interface' "#ifdef REAL_ARITHMETIC"
can ever be true.

However, the code has been this way for a long time, so I keep wondering
if I am missing something.  With an appropriate ChangeLog, should this be
committed?


Index: real.h
===================================================================
RCS file: /FBSD/egcs-repo/Cvs/egcs/gcc/real.h,v
retrieving revision 1.33
diff -u -r1.33 real.h
--- real.h	11 Oct 2001 12:43:42 -0000	1.33
+++ real.h	8 Dec 2001 01:27:15 -0000
@@ -92,7 +92,6 @@
    has been defined to be 96 in the tm.h machine file.  */
 #if (MAX_LONG_DOUBLE_TYPE_SIZE == 96)
 #define REAL_IS_NOT_DOUBLE
-#define REAL_ARITHMETIC
 typedef struct {
   HOST_WIDE_INT r[(11 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))];
 } realvaluetype;
@@ -103,7 +102,6 @@
 #if (MAX_LONG_DOUBLE_TYPE_SIZE == 128)
 
 #define REAL_IS_NOT_DOUBLE
-#define REAL_ARITHMETIC
 typedef struct {
   HOST_WIDE_INT r[(19 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))];
 } realvaluetype;
@@ -135,7 +133,7 @@
    they invoke emulator functions. This will succeed only if the machine
    files have been updated to use these macros in place of any
    references to host machine `double' or `float' types.  */
-#ifdef REAL_ARITHMETIC
+
 #undef REAL_ARITHMETIC
 #define REAL_ARITHMETIC(value, code, d1, d2) \
   earith (&(value), (code), &(d1), &(d2))
@@ -238,34 +236,9 @@
 /* Conversions to decimal ASCII string.  */
 #define REAL_VALUE_TO_DECIMAL(r, fmt, s) (ereal_to_decimal (r, s))
 
-#endif /* REAL_ARITHMETIC defined */
-
 /* **** End of software floating point emulator interface macros **** */
-#else /* No XFmode or TFmode and REAL_ARITHMETIC not defined */
-
-/* old interface */
-#ifdef REAL_ARITHMETIC
-/* Defining REAL_IS_NOT_DOUBLE breaks certain initializations
-   when REAL_ARITHMETIC etc. are not defined.  */
-
-/* Now see if the host and target machines use the same format. 
-   If not, define REAL_IS_NOT_DOUBLE (even if we end up representing
-   reals as doubles because we have no better way in this cross compiler.)
-   This turns off various optimizations that can happen when we know the
-   compiler's float format matches the target's float format.
-   */
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
-#define	REAL_IS_NOT_DOUBLE
-#ifndef REAL_VALUE_TYPE
-typedef struct {
-    HOST_WIDE_INT r[sizeof (double)/sizeof (HOST_WIDE_INT)];
-  } realvaluetype;
-#define REAL_VALUE_TYPE realvaluetype
-#endif /* no REAL_VALUE_TYPE */
-#endif /* formats differ */
-#endif /* 0 */
 
-#endif /* emulator not used */
+#endif /* REAL_ARITHMETIC defined -- emulator not used */
 
 /* If we are not cross-compiling, use a `double' to represent the
    floating-point value.  Otherwise, use some other type



More information about the Gcc-patches mailing list