* src/SDCCval.h: fixed bug #1739860 - sdcc does not work correctly on some
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 30 Sep 2007 06:54:23 +0000 (06:54 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 30 Sep 2007 06:54:23 +0000 (06:54 +0000)
  platforms
* sdcc_vc_in.h: enabled warnings
* src/hc08/gen.c: fixed MSVC warning C4146: unary minus operator applied to
  unsigned type, result still unsigned

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4921 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
sdcc_vc_in.h
src/SDCCval.h

index c0fb9e07ee4f1d32d3f55206a0d6580326b21163..2fc62016d5fd1232baa18ffc677eb19547f18467 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-09-30 Borut Razem <borut.razem AT siol.net>
+
+       * src/SDCCval.h: fixed bug #1739860 - sdcc does not work correctly on some
+         platforms
+       * sdcc_vc_in.h: enabled warnings
+       * src/hc08/gen.c: fixed MSVC warning C4146: unary minus operator applied to
+         unsigned type, result still unsigned
+
 2007-09-28 Raphael Neider <rneider AT web.de>
 
        * src/pic/device.c (find_device): prevent buffer underflow error
index 01f454ac50ebf52b1bf95aa3b6bb5c7f40c416e8..40dbc0818deb7d8955f3491b7e9a9655d6c048e5 100644 (file)
 #undef OPT_DISABLE_PIC
 #undef OPT_DISABLE_XA51
 
-#ifndef _DEBUG
-/*disable warning C4018: signed/unsigned mismatch*/
-#pragma warning( disable : 4018 )
-/*disable warning C4761: integral: size mismatch in argument; conversion supplied*/
-#pragma warning( disable : 4761 )
-/*disable warning C4146: unary minus operator applied to unsigned type, result still unsigned*/
-#pragma warning( disable : 4146 )
-/*disable warning C4244: 'initializing' : conversion from 'double ' to 'char ', possible loss of data*/
-#pragma warning( disable : 4244 )
-#endif
-
 #endif  /* SDCC_VC_HEADER */
 
 /* End of sdcc_vc.h */
index 5160ddd23129920ff0181afa9a1b68a14d67791c..bb49bee7eb9bd0da24f715f4200776b006bba6a7 100644 (file)
 
 
 /* double to unsigned long conversion */
-#define double2ul(val)  (((val) < 0) ? (unsigned long) -((long) -(val)) : (unsigned long) (val))
+/*
+ * See ISO/IEC 9899, chapter 6.3.1.4 Real floating and integer:
+ * If the value of the integral part cannot be represented by the integer type, the behavior is undefined.
+ * This shows up on Mac OS X i386 platform
+ */
+/*
+ * on Mac OS X ppc (long) 2147483648.0 equals to 2147483647, so we explicitely convert it to 0x80000000
+ * on other known platforms (long) 2147483648.0 equals to -2147483648
+ */
+#define double2ul(val)  ((val <= (double)0x80000000UL) ? 0x80000000UL : (((val) < 0) ? (unsigned long) -((long) -(val)) : (unsigned long) (val)))
 
 /* value wrapper */
 typedef struct value