sphere-source-x/lib/libev/wrapper_ev.c
cbnolok 28586ef1d2 Fixed MinGW compilation with both Clang and MSVC runtime libs.
Added different macros, instead of using _MSC_VER. This one is added
even when Clang with MSVC runtime, so it's not viable to check if we're
compiling with MSVC.
2024-10-13 18:30:12 +02:00

60 lines
1.6 KiB
C

// Current libev version: 4.24
#define _LIBEV
// Clang with MSVC backend on Windows defines _MSC_VER! (But also __clang__)
#ifndef MSVC_COMPILER
# if defined(_MSC_VER) && !defined(__clang__)
# define MSVC_COMPILER 1
# endif
#endif
// libev produces many warnings which isn't really appropriate for us to
// address since it is 3rd party code that could be overwritten at any time
// with a new version
#ifdef MSVC_COMPILER
#pragma warning(push)
#pragma warning(disable:4013 4068 4100 4101 4127 4133 4189 4244 4245 4456 4457 4706 4996)
#else
//#define _POSIX_C_SOURCE 1
//#define _POSIX_SOURCE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-value"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wold-style-declaration"
#elif defined(__clang__)
#pragma GCC diagnostic ignored "-Wextern-initializer"
#endif
#ifdef __MINGW__
#include <time.h>
struct timespec
{
time_t tv_sec;
long int tv_nsec;
};
#endif // __MINGW__
#endif
//#define EV_STANDALONE 1
//config.h for ev.c is generated by cmake
#include "libev/ev.c"
#ifdef MSVC_COMPILER
#pragma warning(pop)
#else
#pragma GCC diagnostic pop
#endif
//#endif // _LIBEV