diff options
| author | Jason Evans <jasone@canonware.com> | 2016-10-28 04:29:59 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2016-11-15 22:05:16 (GMT) |
| commit | 84ae60357702bcb9be9584ca1d727fb53ec0491c (patch) | |
| tree | 38a54c7c1741e803c0c1010a461b71eb3a45f9e0 | |
| parent | 72c587a411050d3283052ebfccf3cc64803f2152 (diff) | |
| download | jemalloc-84ae60357702bcb9be9584ca1d727fb53ec0491c.zip jemalloc-84ae60357702bcb9be9584ca1d727fb53ec0491c.tar.gz jemalloc-84ae60357702bcb9be9584ca1d727fb53ec0491c.tar.bz2 | |
Explicitly cast negative constants meant for use as unsigned.
| -rw-r--r-- | test/unit/util.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/unit/util.c b/test/unit/util.c index c958dc0..b1f9abd 100644 --- a/test/unit/util.c +++ b/test/unit/util.c @@ -75,6 +75,7 @@ TEST_BEGIN(test_malloc_strtoumax) }; #define ERR(e) e, #e #define KUMAX(x) ((uintmax_t)x##ULL) +#define KSMAX(x) ((uintmax_t)(intmax_t)x##LL) struct test_s tests[] = { {"0", "0", -1, ERR(EINVAL), UINTMAX_MAX}, {"0", "0", 1, ERR(EINVAL), UINTMAX_MAX}, @@ -87,13 +88,13 @@ TEST_BEGIN(test_malloc_strtoumax) {"42", "", 0, ERR(0), KUMAX(42)}, {"+42", "", 0, ERR(0), KUMAX(42)}, - {"-42", "", 0, ERR(0), KUMAX(-42)}, + {"-42", "", 0, ERR(0), KSMAX(-42)}, {"042", "", 0, ERR(0), KUMAX(042)}, {"+042", "", 0, ERR(0), KUMAX(042)}, - {"-042", "", 0, ERR(0), KUMAX(-042)}, + {"-042", "", 0, ERR(0), KSMAX(-042)}, {"0x42", "", 0, ERR(0), KUMAX(0x42)}, {"+0x42", "", 0, ERR(0), KUMAX(0x42)}, - {"-0x42", "", 0, ERR(0), KUMAX(-0x42)}, + {"-0x42", "", 0, ERR(0), KSMAX(-0x42)}, {"0", "", 0, ERR(0), KUMAX(0)}, {"1", "", 0, ERR(0), KUMAX(1)}, @@ -130,6 +131,7 @@ TEST_BEGIN(test_malloc_strtoumax) }; #undef ERR #undef KUMAX +#undef KSMAX unsigned i; for (i = 0; i < sizeof(tests)/sizeof(struct test_s); i++) { |
