mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-04 22:49:32 +03:00
small compilation warning fixes (extra semicolon etc)
This commit is contained in:
parent
8033b62979
commit
b4825372ab
10 changed files with 18 additions and 18 deletions
|
@ -128,7 +128,7 @@ static inline intptr_t mi_atomic_subi(volatile _Atomic(intptr_t)* p, intptr_t su
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
typedef LONG64 msc_intptr_t;
|
typedef LONG64 msc_intptr_t;
|
||||||
|
|
|
@ -192,7 +192,7 @@ mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_heap_mallocn(mi_heap_
|
||||||
mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_heap_malloc_small(mi_heap_t* heap, size_t size) mi_attr_noexcept mi_attr_malloc mi_attr_alloc_size(2);
|
mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_heap_malloc_small(mi_heap_t* heap, size_t size) mi_attr_noexcept mi_attr_malloc mi_attr_alloc_size(2);
|
||||||
|
|
||||||
mi_decl_nodiscard mi_decl_export void* mi_heap_realloc(mi_heap_t* heap, void* p, size_t newsize) mi_attr_noexcept mi_attr_alloc_size(3);
|
mi_decl_nodiscard mi_decl_export void* mi_heap_realloc(mi_heap_t* heap, void* p, size_t newsize) mi_attr_noexcept mi_attr_alloc_size(3);
|
||||||
mi_decl_nodiscard mi_decl_export void* mi_heap_reallocn(mi_heap_t* heap, void* p, size_t count, size_t size) mi_attr_noexcept mi_attr_alloc_size2(3,4);;
|
mi_decl_nodiscard mi_decl_export void* mi_heap_reallocn(mi_heap_t* heap, void* p, size_t count, size_t size) mi_attr_noexcept mi_attr_alloc_size2(3,4);
|
||||||
mi_decl_nodiscard mi_decl_export void* mi_heap_reallocf(mi_heap_t* heap, void* p, size_t newsize) mi_attr_noexcept mi_attr_alloc_size(3);
|
mi_decl_nodiscard mi_decl_export void* mi_heap_reallocf(mi_heap_t* heap, void* p, size_t newsize) mi_attr_noexcept mi_attr_alloc_size(3);
|
||||||
|
|
||||||
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_heap_strdup(mi_heap_t* heap, const char* s) mi_attr_noexcept mi_attr_malloc;
|
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_heap_strdup(mi_heap_t* heap, const char* s) mi_attr_noexcept mi_attr_malloc;
|
||||||
|
@ -256,7 +256,7 @@ mi_decl_export bool mi_heap_visit_blocks(const mi_heap_t* heap, bool visit_all_b
|
||||||
|
|
||||||
// Experimental
|
// Experimental
|
||||||
mi_decl_nodiscard mi_decl_export bool mi_is_in_heap_region(const void* p) mi_attr_noexcept;
|
mi_decl_nodiscard mi_decl_export bool mi_is_in_heap_region(const void* p) mi_attr_noexcept;
|
||||||
mi_decl_nodiscard mi_decl_export bool mi_is_redirected() mi_attr_noexcept;
|
mi_decl_nodiscard mi_decl_export bool mi_is_redirected(void) mi_attr_noexcept;
|
||||||
|
|
||||||
mi_decl_export int mi_reserve_huge_os_pages_interleave(size_t pages, size_t numa_nodes, size_t timeout_msecs) mi_attr_noexcept;
|
mi_decl_export int mi_reserve_huge_os_pages_interleave(size_t pages, size_t numa_nodes, size_t timeout_msecs) mi_attr_noexcept;
|
||||||
mi_decl_export int mi_reserve_huge_os_pages_at(size_t pages, int numa_node, size_t timeout_msecs) mi_attr_noexcept;
|
mi_decl_export int mi_reserve_huge_os_pages_at(size_t pages, int numa_node, size_t timeout_msecs) mi_attr_noexcept;
|
||||||
|
|
|
@ -684,7 +684,7 @@ mi_decl_restrict char* mi_strndup(const char* s, size_t n) mi_attr_noexcept {
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX MAX_PATH
|
#define PATH_MAX MAX_PATH
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
mi_decl_restrict char* mi_heap_realpath(mi_heap_t* heap, const char* fname, char* resolved_name) mi_attr_noexcept {
|
mi_decl_restrict char* mi_heap_realpath(mi_heap_t* heap, const char* fname, char* resolved_name) mi_attr_noexcept {
|
||||||
// todo: use GetFullPathNameW to allow longer file names
|
// todo: use GetFullPathNameW to allow longer file names
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
@ -765,12 +765,12 @@ typedef void (*std_new_handler_t)();
|
||||||
std_new_handler_t __attribute((weak)) _ZSt15get_new_handlerv() {
|
std_new_handler_t __attribute((weak)) _ZSt15get_new_handlerv() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
std_new_handler_t mi_get_new_handler() {
|
static std_new_handler_t mi_get_new_handler() {
|
||||||
return _ZSt15get_new_handlerv();
|
return _ZSt15get_new_handlerv();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// note: on windows we could dynamically link to `?get_new_handler@std@@YAP6AXXZXZ`.
|
// note: on windows we could dynamically link to `?get_new_handler@std@@YAP6AXXZXZ`.
|
||||||
std_new_handler_t mi_get_new_handler() {
|
static std_new_handler_t mi_get_new_handler() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
10
src/init.c
10
src/init.c
|
@ -285,7 +285,7 @@ static void _mi_thread_done(mi_heap_t* default_heap);
|
||||||
// nothing to do as it is done in DllMain
|
// nothing to do as it is done in DllMain
|
||||||
#elif defined(_WIN32) && !defined(MI_SHARED_LIB)
|
#elif defined(_WIN32) && !defined(MI_SHARED_LIB)
|
||||||
// use thread local storage keys to detect thread ending
|
// use thread local storage keys to detect thread ending
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
#include <fibersapi.h>
|
#include <fibersapi.h>
|
||||||
#if (_WIN32_WINNT < 0x600) // before Windows Vista
|
#if (_WIN32_WINNT < 0x600) // before Windows Vista
|
||||||
WINBASEAPI DWORD WINAPI FlsAlloc( _In_opt_ PFLS_CALLBACK_FUNCTION lpCallback );
|
WINBASEAPI DWORD WINAPI FlsAlloc( _In_opt_ PFLS_CALLBACK_FUNCTION lpCallback );
|
||||||
|
@ -405,11 +405,11 @@ static bool os_preloading = true; // true until this module is initialized
|
||||||
static bool mi_redirected = false; // true if malloc redirects to mi_malloc
|
static bool mi_redirected = false; // true if malloc redirects to mi_malloc
|
||||||
|
|
||||||
// Returns true if this module has not been initialized; Don't use C runtime routines until it returns false.
|
// Returns true if this module has not been initialized; Don't use C runtime routines until it returns false.
|
||||||
bool _mi_preloading() {
|
bool _mi_preloading(void) {
|
||||||
return os_preloading;
|
return os_preloading;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mi_is_redirected() mi_attr_noexcept {
|
bool mi_is_redirected(void) mi_attr_noexcept {
|
||||||
return mi_redirected;
|
return mi_redirected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ mi_decl_export void _mi_redirect_entry(DWORD reason) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__declspec(dllimport) bool mi_allocator_init(const char** message);
|
__declspec(dllimport) bool mi_allocator_init(const char** message);
|
||||||
__declspec(dllimport) void mi_allocator_done();
|
__declspec(dllimport) void mi_allocator_done(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -440,7 +440,7 @@ static bool mi_allocator_init(const char** message) {
|
||||||
if (message != NULL) *message = NULL;
|
if (message != NULL) *message = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static void mi_allocator_done() {
|
static void mi_allocator_done(void) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -413,7 +413,7 @@ static inline int mi_strnicmp(const char* s, const char* t, size_t n) {
|
||||||
// reliably even when this is invoked before the C runtime is initialized.
|
// reliably even when this is invoked before the C runtime is initialized.
|
||||||
// i.e. when `_mi_preloading() == true`.
|
// i.e. when `_mi_preloading() == true`.
|
||||||
// Note: on windows, environment names are not case sensitive.
|
// Note: on windows, environment names are not case sensitive.
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
||||||
result[0] = 0;
|
result[0] = 0;
|
||||||
size_t len = GetEnvironmentVariableA(name, result, (DWORD)result_size);
|
size_t len = GetEnvironmentVariableA(name, result, (DWORD)result_size);
|
||||||
|
|
2
src/os.c
2
src/os.c
|
@ -24,7 +24,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
#elif defined(__wasi__)
|
#elif defined(__wasi__)
|
||||||
// stdlib.h is all we need, and has already been included in mimalloc.h
|
// stdlib.h is all we need, and has already been included in mimalloc.h
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -234,7 +234,7 @@ static bool os_random_buf(void* buf, size_t buf_len) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <mach/mach_time.h>
|
#include <mach/mach_time.h>
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -384,7 +384,7 @@ void mi_thread_stats_print_out(mi_output_fun* out, void* arg) mi_attr_noexcept {
|
||||||
// Basic timer for convenience; use milli-seconds to avoid doubles
|
// Basic timer for convenience; use milli-seconds to avoid doubles
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
static mi_msecs_t mi_to_msecs(LARGE_INTEGER t) {
|
static mi_msecs_t mi_to_msecs(LARGE_INTEGER t) {
|
||||||
static LARGE_INTEGER mfreq; // = 0
|
static LARGE_INTEGER mfreq; // = 0
|
||||||
if (mfreq.QuadPart == 0LL) {
|
if (mfreq.QuadPart == 0LL) {
|
||||||
|
@ -439,7 +439,7 @@ mi_msecs_t _mi_clock_end(mi_msecs_t start) {
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#pragma comment(lib,"psapi.lib")
|
#pragma comment(lib,"psapi.lib")
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
static void msleep(unsigned long msecs) { Sleep(msecs); }
|
static void msleep(unsigned long msecs) { Sleep(msecs); }
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
@ -260,7 +260,7 @@ static void (*thread_entry_fun)(intptr_t) = &stress;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
static DWORD WINAPI thread_entry(LPVOID param) {
|
static DWORD WINAPI thread_entry(LPVOID param) {
|
||||||
thread_entry_fun((intptr_t)param);
|
thread_entry_fun((intptr_t)param);
|
||||||
|
|
Loading…
Add table
Reference in a new issue