On Thu, 31 Jul 2008, Szakáts Viktor wrote:
Hi Viktor,
> >2) BCC58 old one:
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 77: Redefinition of
> >'INT16_MIN' is not identical
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 78: Redefinition of
> >'INT32_MIN' is not identical
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 79: Redefinition of
> >'INT64_MIN' is not identical
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 82: Redefinition of
> >'INT16_MAX' is not identical
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 83: Redefinition of
> >'INT32_MAX' is not identical
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 84: Redefinition of
> >'INT64_MAX' is not identical
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 87: Redefinition of
> >'UINT16_MAX' is not identical
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 88: Redefinition of
> >'UINT32_MAX' is not identical
> >Warning W8017 C:\devl\BCC58\Include\stdint.h 89: Redefinition of
> >'UINT64_MAX' is not identical
> >Couldn't we use HB_ prefixed versions of *_MAX inside Harbour to
> >avoid the above problem?
> What do you think about it? Is this nonsense?
We try to use original stdint.h definitions and we define above
only if compiler does not support them so using HB_ prefix does
not resolves the problem. I strongly prefer to use original
definitions because on some platforms (f.e. MIPS390) their values
are not the same as for x86.
Now we should enable:
#include <stdint.h>
for BCC >= 5.8 (defined( __BORLANDC__ ) && __BORLANDC__ >= 1410) because
it supports these definitions. Unfortunately as far as I remember BCC
INT32_MIN definition exploits bug in BCC which later causes other warnings.
Please try to compile this code:
#include <stdint.h>
int f( void )
{
return INT32_MIN;
}
As you can see it's nothing more then BCC bug.
The only one solution I know is changing in hbdefs.h:
#if defined( __XCC__ ) || defined( __MINGW32__ ) || \
( defined( __GNUC__ ) && \
( defined( HB_OS_LINUX ) || defined( HB_OS_DARWIN ) ) )
# include <stdint.h>
#elif defined( __BORLANDC__ )
# include "bcstdint.h"
#endif
to:
#if defined( __XCC__ ) || defined( __MINGW32__ ) || \
( defined( __BORLANDC__ ) && __BORLANDC__ >= 1410 ) || \
( defined( __GNUC__ ) && \
( defined( HB_OS_LINUX ) || defined( HB_OS_DARWIN ) ) )
# include <stdint.h>
/* workaround for BCC bug */
# if ( defined( __BORLANDC__ ) && __BORLANDC__ >= 1410 )
# undef INT32_MIN
# define INT32_MIN ((int32_t) -0x8000000)
# endif
#endif
probably instead of:
# define INT32_MIN ((int32_t) -0x8000000)
it will be better/cleaner for x86 based platforms to use:
# define INT32_MIN ((int32_t) (-INT32_MAX-1))
and then we can wait for fixed <stdint.h> in new BCC version
to add upper __BORLANDC__ version number to protect this
workaround.
If with above modification you can cleanly compile Harbour using
BCC5.8 then please commit them.
best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour