mdbx: add mdbx_osal.h with platform-like err codes.

This commit is contained in:
Leo Yuriev
2017-04-24 15:45:20 +03:00
parent f7507110ef
commit 2e54210e79
7 changed files with 265 additions and 232 deletions

89
mdbx.h
View File

@@ -52,95 +52,8 @@
#ifndef _MDBX_H_
#define _MDBX_H_
#define MDBX_MODE_ENABLED 1
#ifndef __has_attribute
# define __has_attribute(x) (0)
#endif
#ifndef __dll_export
# if defined(_WIN32) || defined(__CYGWIN__)
# if defined(__GNUC__) || __has_attribute(dllexport)
# define __dll_export __attribute__((dllexport))
# elif defined(_MSC_VER)
# define __dll_export __declspec(dllexport)
# else
# define __dll_export
# endif
# elif defined(__GNUC__) || __has_attribute(visibility)
# define __dll_export __attribute__((visibility("default")))
# else
# define __dll_export
# endif
#endif /* __dll_export */
#ifndef __dll_import
# if defined(_WIN32) || defined(__CYGWIN__)
# if defined(__GNUC__) || __has_attribute(dllimport)
# define __dll_import __attribute__((dllimport))
# elif defined(_MSC_VER)
# define __dll_import __declspec(dllimport)
# else
# define __dll_import
# endif
# else
# define __dll_import
# endif
#endif /* __dll_import */
#if defined(LIBMDBX_EXPORTS)
# define LIBMDBX_API __dll_export
#elif defined(LIBMDBX_IMPORTS)
# define LIBMDBX_API __dll_import
#else
# define LIBMDBX_API
#endif /* LIBMDBX_API */
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4514) /* 'xyz': unreferenced inline function \
has been removed */
#pragma warning(disable : 4710) /* 'xyz': function not inlined */
#pragma warning(disable : 4711) /* function 'xyz' selected for \
automatic inline expansion */
#pragma warning(disable : 4061) /* enumerator 'abc' in switch of enum \
'xyz' is not explicitly handled by a case \
label */
#pragma warning(disable : 4201) /* nonstandard extension used : \
nameless struct / union */
#pragma warning(disable : 4127) /* conditional expression is constant \
*/
#pragma warning(push, 1)
#pragma warning(disable : 4530) /* C++ exception handler used, but \
unwind semantics are not enabled. Specify \
/EHsc */
#pragma warning(disable : 4577) /* 'noexcept' used with no exception \
handling mode specified; termination on \
exception is not guaranteed. Specify /EHsc \
*/
#endif /* _MSC_VER (warnings) */
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#if defined(_WIN32) || defined(_WIN64)
# include <windows.h>
# include <winnt.h>
typedef unsigned mode_t;
typedef HANDLE mdbx_filehandle_t;
typedef DWORD mdbx_pid_t;
typedef DWORD mdbx_tid_t;
#else
# include <pthread.h> /* for pthread_t */
# include <sys/uio.h> /* for truct iovec */
# include <sys/types.h> /* for pid_t */
# define HAVE_STRUCT_IOVEC 1
typedef int mdbx_filehandle_t;
typedef pid_t mdbx_pid_t;
typedef pthread_t mdbx_tid_t;
#endif
#include "mdbx_osal.h"
#ifdef _MSC_VER
#pragma warning(pop)