Use non-fixed-width types in integer identity_traits definitions

In some situations (e.g. 32-bit Linux), "intptr_t" is defined as "int", which is
equivalent to "int32_t", leading to issues with duplicate definitions. In other
situations with GCC, "intptr_t" is "long", which isn't covered by any intNN_t
types. Also, definitions for "long" already had to be added on Windows, because
no fixed-width types in MSVC are equivalent to "long".

Switching to non-fixed-width types should hopefully cover all of these
situations. If this doesn't cover any integer types that we need, it will
be caught quickly, e.g. by references to integer_traits<T> in LuaWrapper.cpp.
develop
lethosor 2016-08-08 11:46:20 -04:00
parent 298d16238e
commit e22b3b1de7
2 changed files with 16 additions and 26 deletions

@ -18,21 +18,16 @@ namespace df {
#ifndef STATIC_FIELDS_GROUP
INTEGER_IDENTITY_TRAITS(char);
INTEGER_IDENTITY_TRAITS(int8_t);
INTEGER_IDENTITY_TRAITS(uint8_t);
INTEGER_IDENTITY_TRAITS(int16_t);
INTEGER_IDENTITY_TRAITS(uint16_t);
INTEGER_IDENTITY_TRAITS(int32_t);
INTEGER_IDENTITY_TRAITS(uint32_t);
INTEGER_IDENTITY_TRAITS(int64_t);
INTEGER_IDENTITY_TRAITS(uint64_t);
#ifdef _WIN32
INTEGER_IDENTITY_TRAITS(signed char);
INTEGER_IDENTITY_TRAITS(unsigned char);
INTEGER_IDENTITY_TRAITS(short);
INTEGER_IDENTITY_TRAITS(unsigned short);
INTEGER_IDENTITY_TRAITS(int);
INTEGER_IDENTITY_TRAITS(unsigned int);
INTEGER_IDENTITY_TRAITS(long);
INTEGER_IDENTITY_TRAITS(unsigned long);
#else
INTEGER_IDENTITY_TRAITS(intptr_t);
INTEGER_IDENTITY_TRAITS(uintptr_t);
#endif
INTEGER_IDENTITY_TRAITS(long long);
INTEGER_IDENTITY_TRAITS(unsigned long long);
FLOAT_IDENTITY_TRAITS(float);
FLOAT_IDENTITY_TRAITS(double);

@ -516,21 +516,16 @@ namespace df
#define FLOAT_IDENTITY_TRAITS(type) NUMBER_IDENTITY_TRAITS(float, type)
INTEGER_IDENTITY_TRAITS(char);
INTEGER_IDENTITY_TRAITS(int8_t);
INTEGER_IDENTITY_TRAITS(uint8_t);
INTEGER_IDENTITY_TRAITS(int16_t);
INTEGER_IDENTITY_TRAITS(uint16_t);
INTEGER_IDENTITY_TRAITS(int32_t);
INTEGER_IDENTITY_TRAITS(uint32_t);
INTEGER_IDENTITY_TRAITS(int64_t);
INTEGER_IDENTITY_TRAITS(uint64_t);
#ifdef _WIN32
INTEGER_IDENTITY_TRAITS(signed char);
INTEGER_IDENTITY_TRAITS(unsigned char);
INTEGER_IDENTITY_TRAITS(short);
INTEGER_IDENTITY_TRAITS(unsigned short);
INTEGER_IDENTITY_TRAITS(int);
INTEGER_IDENTITY_TRAITS(unsigned int);
INTEGER_IDENTITY_TRAITS(long);
INTEGER_IDENTITY_TRAITS(unsigned long);
#else
INTEGER_IDENTITY_TRAITS(intptr_t);
INTEGER_IDENTITY_TRAITS(uintptr_t);
#endif
INTEGER_IDENTITY_TRAITS(long long);
INTEGER_IDENTITY_TRAITS(unsigned long long);
FLOAT_IDENTITY_TRAITS(float);
FLOAT_IDENTITY_TRAITS(double);