| 1 |
/* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */ |
| 2 |
|
| 3 |
#ifndef MPT_CHECK_LIBC_HPP |
| 4 |
#define MPT_CHECK_LIBC_HPP |
| 5 |
|
| 6 |
#include "mpt/base/detect_libc.hpp" |
| 7 |
#include "mpt/base/detect_os.hpp" |
| 8 |
#include "mpt/base/detect_quirks.hpp" |
| 9 |
#include "mpt/base/compiletime_warning.hpp" |
| 10 |
|
| 11 |
#ifndef MPT_CHECK_LIBC_IGNORE_WARNING_NO_MTRT |
| 12 |
#if MPT_PLATFORM_MULTITHREADED |
| 13 |
#if MPT_LIBC_MINGW |
| 14 |
// MinGW only has `#define _MT` in header files instead of `#define _MT 1`. |
| 15 |
#if !defined(_MT) |
| 16 |
MPT_WARNING("C stdlib is not multi-threaded.") |
| 17 |
#endif |
| 18 |
#elif MPT_LIBC_MS |
| 19 |
#if defined(_MT) |
| 20 |
#if (_MT != 1) |
| 21 |
MPT_WARNING("C stdlib is not multi-threaded.") |
| 22 |
#endif |
| 23 |
#else |
| 24 |
MPT_WARNING("C stdlib is not multi-threaded.") |
| 25 |
#endif |
| 26 |
//#elif !MPT_LIBC_MS && !MPT_LIBC_MINGW && !MPT_LIBC_GENERIC |
| 27 |
//#if (!defined(_REENTRANT) || (_REENTRANT != 1)) |
| 28 |
//MPT_WARNING("C stdlib is not multi-threaded.") |
| 29 |
//#endif |
| 30 |
#endif |
| 31 |
#endif |
| 32 |
#endif |
| 33 |
|
| 34 |
#ifndef MPT_CHECK_LIBC_IGNORE_WARNING_UNICODE_MISMATCH |
| 35 |
#if MPT_OS_WINDOWS |
| 36 |
#ifdef UNICODE |
| 37 |
#ifndef _UNICODE |
| 38 |
MPT_WARNING("UNICODE is defined but _UNICODE is not defined. Please #define _UNICODE.") |
| 39 |
#endif |
| 40 |
#endif |
| 41 |
#endif // MPT_OS_WINDOWS |
| 42 |
#endif |
| 43 |
|
| 44 |
#endif // MPT_CHECK_LIBC_HPP |