diff --git a/GNUmakefile b/GNUmakefile index 6dff9346..5d9d25b9 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -236,10 +236,7 @@ dist/@tmp-shared_internals.inc: src/elements/version.c $(ALLOY_DEPS) $(lastword dist/mdbx.c: dist/@tmp-shared_internals.inc $(lastword $(MAKEFILE_LIST)) mkdir -p dist && (cat dist/@tmp-shared_internals.inc \ - && cat src/elements/core.c src/elements/osal.c src/elements/version.c \ - && echo '#if defined(_WIN32) || defined(_WIN64)' \ - && cat src/elements/lck-windows.c && echo '#else /* LCK-implementation */' \ - && cat src/elements/lck-posix.c && echo '#endif /* LCK-implementation */' \ + && cat src/elements/core.c src/elements/osal.c src/elements/version.c src/elements/lck-windows.c src/elements/lck-posix.c \ ) | grep -v -e '#include "' -e '#pragma once' | sed 's|@INCLUDE|#include|' > $@ define dist-tool-rule diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 82c953da..8a33ede3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,14 +19,9 @@ message(STATUS "libmdbx version is ${MDBX_VERSION}") if(MDBX_ALLOY_MODE) set(LIBMDBX_SOURCES alloy.c) else() - if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(LIBMDBX_OSAL windows) - else() - set(LIBMDBX_OSAL posix) - endif() set(LIBMDBX_SOURCES elements/options.h elements/defs.h elements/internals.h elements/osal.h - elements/core.c elements/osal.c elements/lck-${LIBMDBX_OSAL}.c) + elements/core.c elements/osal.c elements/lck-posix.c elements/lck-windows.c) endif() list(APPEND LIBMDBX_SOURCES ../mdbx.h "${CMAKE_CURRENT_SOURCE_DIR}/elements/version.c" diff --git a/src/elements/lck-posix.c b/src/elements/lck-posix.c index 7ef4ca4d..3754c253 100644 --- a/src/elements/lck-posix.c +++ b/src/elements/lck-posix.c @@ -12,6 +12,8 @@ * . */ +#if !(defined(_WIN32) || defined(_WIN64)) /* !Windows LCK-implementation */ + #include "internals.h" #include @@ -803,3 +805,10 @@ void mdbx_txn_unlock(MDBX_env *env) { mdbx_panic("%s() failed: err %d\n", __func__, rc); mdbx_jitter4testing(true); } + +#else +#ifdef _MSC_VER +#pragma warning(disable : 4206) /* nonstandard extension used: translation \ + unit is empty */ +#endif /* _MSC_VER (warnings) */ +#endif /* !Windows LCK-implementation */ diff --git a/src/elements/lck-windows.c b/src/elements/lck-windows.c index 264937d9..13178139 100644 --- a/src/elements/lck-windows.c +++ b/src/elements/lck-windows.c @@ -12,17 +12,15 @@ * . */ -#include "internals.h" +#if defined(_WIN32) || defined(_WIN64) /* Windows LCK-implementation */ /* PREAMBLE FOR WINDOWS: * * We are not concerned for performance here. * If you are running Windows a performance could NOT be the goal. - * Otherwise please use Linux. - * - * Regards, - * LY - */ + * Otherwise please use Linux. */ + +#include "internals.h" static void mdbx_winnt_import(void); @@ -799,3 +797,5 @@ static void mdbx_winnt_import(void) { mdbx_srwlock_ReleaseExclusive = stub_srwlock_ReleaseExclusive; } } + +#endif /* Windows LCK-implementation */