mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-15 16:36:03 +08:00
Add support to cross-compile with clang (#389)
Clang does not define __WCHAR_MIN__ however, limits.h relies on it. By using the __AVR__ macro we can define __WCHAR_MIN__ only when cross-compiling with clang.
This commit is contained in:
parent
2e0c2a4099
commit
32d80e91e7
@ -332,6 +332,11 @@ namespace etl
|
||||
static ETL_CONSTANT bool is_signed = etl::is_signed<wchar_t>::value;
|
||||
static ETL_CONSTANT bool is_modulo = etl::is_unsigned<wchar_t>::value;
|
||||
|
||||
#if defined(ETL_COMPILER_CLANG) && defined(CROSS_COMPILING_TO_AVR)
|
||||
#undef WCHAR_MIN
|
||||
#define WCHAR_MIN (-WCHAR_MAX - 1)
|
||||
#endif
|
||||
|
||||
static ETL_CONSTEXPR wchar_t min() { return WCHAR_MIN; }
|
||||
static ETL_CONSTEXPR wchar_t max() { return WCHAR_MAX; }
|
||||
static ETL_CONSTEXPR wchar_t lowest() { return WCHAR_MIN; }
|
||||
|
||||
@ -75,6 +75,9 @@ SOFTWARE.
|
||||
#if defined(__clang__) || defined(__llvm__)
|
||||
#define ETL_COMPILER_CLANG
|
||||
#define ETL_COMPILER_TYPE_DETECTED
|
||||
#if __AVR__ == 1
|
||||
#define CROSS_COMPILING_TO_AVR
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user