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
+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
2007-09-28 Raphael Neider <rneider AT web.de>
* src/pic/device.c (find_device): prevent buffer underflow error
#undef OPT_DISABLE_PIC
#undef OPT_DISABLE_XA51
#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 */
#endif /* SDCC_VC_HEADER */
/* End of sdcc_vc.h */
/* double to unsigned long conversion */
/* 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
/* value wrapper */
typedef struct value