Avoid warnings about narrowing casts in the long long tests.
Recent g++ versions give -Wnarrowing warning when a value outside of the type range is used to initialize a variable of this type in { }. Avoid it in the long long tests using explicit casts as we already cast between long long and unsigned long long values here anyhow.
This commit is contained in:
@@ -602,14 +602,16 @@ enum
|
|||||||
Number_Long = 16 // only for long tests
|
Number_Long = 16 // only for long tests
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef wxLongLong_t
|
||||||
|
typedef wxLongLong_t TestValue_t;
|
||||||
|
#else
|
||||||
|
typedef long TestValue_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct ToLongData
|
static const struct ToLongData
|
||||||
{
|
{
|
||||||
const wxChar *str;
|
const wxChar *str;
|
||||||
#ifdef wxLongLong_t
|
TestValue_t value;
|
||||||
wxLongLong_t value;
|
|
||||||
#else
|
|
||||||
long value;
|
|
||||||
#endif // wxLongLong_t
|
|
||||||
int flags;
|
int flags;
|
||||||
int base;
|
int base;
|
||||||
|
|
||||||
@@ -631,7 +633,7 @@ static const struct ToLongData
|
|||||||
|
|
||||||
{ wxT("-1"), -1, Number_Signed | Number_Long },
|
{ wxT("-1"), -1, Number_Signed | Number_Long },
|
||||||
// this is surprising but consistent with strtoul() behaviour
|
// this is surprising but consistent with strtoul() behaviour
|
||||||
{ wxT("-1"), ULONG_MAX, Number_Unsigned | Number_Long },
|
{ wxT("-1"), (TestValue_t)ULONG_MAX, Number_Unsigned | Number_Long },
|
||||||
|
|
||||||
// this must overflow, even with 64 bit long
|
// this must overflow, even with 64 bit long
|
||||||
{ wxT("922337203685477580711"), 0, Number_Invalid },
|
{ wxT("922337203685477580711"), 0, Number_Invalid },
|
||||||
@@ -639,8 +641,9 @@ static const struct ToLongData
|
|||||||
#ifdef wxLongLong_t
|
#ifdef wxLongLong_t
|
||||||
{ wxT("2147483648"), wxLL(2147483648), Number_LongLong },
|
{ wxT("2147483648"), wxLL(2147483648), Number_LongLong },
|
||||||
{ wxT("-2147483648"), wxLL(-2147483648), Number_LongLong | Number_Signed },
|
{ wxT("-2147483648"), wxLL(-2147483648), Number_LongLong | Number_Signed },
|
||||||
{ wxT("9223372036854775808"), wxULL(9223372036854775808), Number_LongLong |
|
{ wxT("9223372036854775808"),
|
||||||
Number_Unsigned },
|
TestValue_t(wxULL(9223372036854775808)),
|
||||||
|
Number_LongLong | Number_Unsigned },
|
||||||
#endif // wxLongLong_t
|
#endif // wxLongLong_t
|
||||||
|
|
||||||
// Base tests.
|
// Base tests.
|
||||||
|
Reference in New Issue
Block a user