From 94a2ba4eda931cd4d4fc1c786a748888b3fc982b Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Tue, 23 Jun 2020 09:40:06 +0100 Subject: [PATCH] Revert "fixes for mingw (#215)" (#216) This reverts commit 8f6b8db4edc406469e13f9106b8e17e90305c385. --- src/pal/pal_windows.h | 1 - src/test/func/malloc/malloc.cc | 28 +++++++++------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/pal/pal_windows.h b/src/pal/pal_windows.h index 01121d9..08e8c17 100644 --- a/src/pal/pal_windows.h +++ b/src/pal/pal_windows.h @@ -6,7 +6,6 @@ #ifdef _WIN32 # ifndef _MSC_VER # include -# include # endif # define WIN32_LEAN_AND_MEAN # ifndef NOMINMAX diff --git a/src/test/func/malloc/malloc.cc b/src/test/func/malloc/malloc.cc index 1d54525..029428d 100644 --- a/src/test/func/malloc/malloc.cc +++ b/src/test/func/malloc/malloc.cc @@ -4,12 +4,6 @@ #define SNMALLOC_NAME_MANGLE(a) our_##a #include "../../../override/malloc.cc" -#if defined(_WIN32) && !defined(_MSC_VER) -# define ST_FMT "I" -#else -# define ST_FMT "z" -#endif - using namespace snmalloc; void check_result(size_t size, size_t align, void* p, int err, bool null) @@ -31,7 +25,7 @@ void check_result(size_t size, size_t align, void* p, int err, bool null) if ((align == 1) && (alloc_size != expected_size)) { printf( - "Usable size is %" ST_FMT "u, but required to be %" ST_FMT "u.\n", + "Usable size is %zu, but required to be %zu.\n", alloc_size, expected_size); abort(); @@ -39,8 +33,7 @@ void check_result(size_t size, size_t align, void* p, int err, bool null) if ((align != 1) && (alloc_size < expected_size)) { printf( - "Usable size is %" ST_FMT "u, but required to be at least %" ST_FMT - "u.\n", + "Usable size is %zu, but required to be at least %zu.\n", alloc_size, expected_size); abort(); @@ -48,8 +41,7 @@ void check_result(size_t size, size_t align, void* p, int err, bool null) if (static_cast(reinterpret_cast(p) % align) != 0) { printf( - "Address is 0x%" ST_FMT "x, but required to be aligned to 0x%" ST_FMT - "x.\n", + "Address is 0x%zx, but required to be aligned to 0x%zx.\n", reinterpret_cast(p), align); abort(); @@ -60,7 +52,7 @@ void check_result(size_t size, size_t align, void* p, int err, bool null) void test_calloc(size_t nmemb, size_t size, int err, bool null) { - fprintf(stderr, "calloc(%" ST_FMT "u, %" ST_FMT "u)\n", nmemb, size); + fprintf(stderr, "calloc(%zu, %zu)\n", nmemb, size); errno = 0; void* p = our_calloc(nmemb, size); @@ -81,8 +73,7 @@ void test_realloc(void* p, size_t size, int err, bool null) if (p != nullptr) old_size = our_malloc_usable_size(p); - fprintf( - stderr, "realloc(%p(%" ST_FMT "u), %" ST_FMT "u)\n", p, old_size, size); + fprintf(stderr, "realloc(%p(%zu), %zu)\n", p, old_size, size); errno = 0; auto new_p = our_realloc(p, size); // Realloc failure case, deallocate original block @@ -93,8 +84,7 @@ void test_realloc(void* p, size_t size, int err, bool null) void test_posix_memalign(size_t size, size_t align, int err, bool null) { - fprintf( - stderr, "posix_memalign(&p, %" ST_FMT "u, %" ST_FMT "u)\n", align, size); + fprintf(stderr, "posix_memalign(&p, %zu, %zu)\n", align, size); void* p = nullptr; errno = our_posix_memalign(&p, align, size); check_result(size, align, p, err, null); @@ -102,7 +92,7 @@ void test_posix_memalign(size_t size, size_t align, int err, bool null) void test_memalign(size_t size, size_t align, int err, bool null) { - fprintf(stderr, "memalign(%" ST_FMT "u, %" ST_FMT "u)\n", align, size); + fprintf(stderr, "memalign(%zu, %zu)\n", align, size); errno = 0; void* p = our_memalign(align, size); check_result(size, align, p, err, null); @@ -122,7 +112,7 @@ int main(int argc, char** argv) for (sizeclass_t sc = 0; sc < (SUPERSLAB_BITS + 4); sc++) { const size_t size = 1ULL << sc; - printf("malloc: %" ST_FMT "u\n", size); + printf("malloc: %zu\n", size); check_result(size, 1, our_malloc(size), SUCCESS, false); check_result(size + 1, 1, our_malloc(size + 1), SUCCESS, false); } @@ -170,7 +160,7 @@ int main(int argc, char** argv) for (sizeclass_t sc2 = 0; sc2 < (SUPERSLAB_BITS + 4); sc2++) { const size_t size2 = 1ULL << sc2; - printf("size1: %" ST_FMT "u, size2:%" ST_FMT "u\n", size, size2); + printf("size1: %zu, size2:%zu\n", size, size2); test_realloc(our_malloc(size), size2, SUCCESS, false); test_realloc(our_malloc(size + 1), size2, SUCCESS, false); }