From: borutr Date: Sun, 30 Sep 2007 06:54:23 +0000 (+0000) Subject: * src/SDCCval.h: fixed bug #1739860 - sdcc does not work correctly on some X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=a9f3838bdbedc49bb24f63070e0bef2e6fb5edea;p=fw%2Fsdcc * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4921 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index c0fb9e07..2fc62016 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-09-30 Borut Razem + + * 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 * src/pic/device.c (find_device): prevent buffer underflow error diff --git a/sdcc_vc_in.h b/sdcc_vc_in.h index 01f454ac..40dbc081 100644 --- a/sdcc_vc_in.h +++ b/sdcc_vc_in.h @@ -70,17 +70,6 @@ #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 */ diff --git a/src/SDCCval.h b/src/SDCCval.h index 5160ddd2..bb49bee7 100644 --- a/src/SDCCval.h +++ b/src/SDCCval.h @@ -27,7 +27,16 @@ /* 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