diff --git a/include/etl/basic_string.h b/include/etl/basic_string.h index b58e9599..17ee2480 100644 --- a/include/etl/basic_string.h +++ b/include/etl/basic_string.h @@ -55,13 +55,7 @@ SOFTWARE. #pragma GCC diagnostic ignored "-Wunused-variable" #endif -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#endif - -#ifdef ETL_COMPILER_MICROSOFT -#undef max -#endif +#include "private/minmax_push.h" //***************************************************************************** ///\defgroup basic_string basic_string @@ -2234,13 +2228,7 @@ namespace etl } } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#ifdef ETL_COMPILER_MICROSOFT -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/bitset.h b/include/etl/bitset.h index 3e42bd86..ae328129 100644 --- a/include/etl/bitset.h +++ b/include/etl/bitset.h @@ -46,9 +46,7 @@ SOFTWARE. #include "integral_limits.h" #include "binary.h" -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#endif +#include "private/minmax_push.h" #include "error_handler.h" @@ -1018,8 +1016,6 @@ void swap(etl::bitset& lhs, etl::bitset& rhs) lhs.swap(rhs); } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/include/etl/cstring.h b/include/etl/cstring.h index f2a0ee9a..0ddfc80a 100644 --- a/include/etl/cstring.h +++ b/include/etl/cstring.h @@ -39,9 +39,7 @@ SOFTWARE. #include #endif -#if defined(ETL_COMPILER_MICROSOFT) -#undef min -#endif +#include "private/minmax_push.h" namespace etl { @@ -227,8 +225,6 @@ namespace etl #endif } -#if defined(ETL_COMPILER_MICROSOFT) -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/include/etl/deque.h b/include/etl/deque.h index 08228ddc..da898328 100644 --- a/include/etl/deque.h +++ b/include/etl/deque.h @@ -52,9 +52,7 @@ SOFTWARE. #include #endif -#ifdef ETL_COMPILER_MICROSOFT - #undef min -#endif +#include "private/minmax_push.h" #undef ETL_FILE #define ETL_FILE "1" @@ -2194,8 +2192,6 @@ bool operator >=(const etl::ideque& lhs, const etl::ideque& rhs) #undef ETL_FILE -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/include/etl/forward_list.h b/include/etl/forward_list.h index 6249e0ba..407380d3 100644 --- a/include/etl/forward_list.h +++ b/include/etl/forward_list.h @@ -50,9 +50,7 @@ SOFTWARE. #include #endif -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#endif +#include "private/minmax_push.h" #undef ETL_FILE #define ETL_FILE "6" @@ -1536,9 +1534,7 @@ bool operator >=(const etl::iforward_list& lhs, const etl::iforward_list& return !(lhs < rhs); } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/fsm.h b/include/etl/fsm.h index 54a06c36..eeb343b9 100644 --- a/include/etl/fsm.h +++ b/include/etl/fsm.h @@ -66,9 +66,7 @@ SOFTWARE. #undef ETL_FILE #define ETL_FILE "34" -#ifdef ETL_COMPILER_MICROSOFT -#undef max -#endif +#include "private/minmax_push.h" namespace etl { @@ -1215,8 +1213,6 @@ namespace etl #undef ETL_FILE -#ifdef ETL_COMPILER_MICROSOFT -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/include/etl/fsm_generator.h b/include/etl/fsm_generator.h index 63eb4f75..91997b63 100644 --- a/include/etl/fsm_generator.h +++ b/include/etl/fsm_generator.h @@ -78,9 +78,7 @@ cog.outl("//******************************************************************** #undef ETL_FILE #define ETL_FILE "34" -#ifdef ETL_COMPILER_MICROSOFT -#undef max -#endif +#include "private/minmax_push.h" namespace etl { @@ -538,8 +536,6 @@ namespace etl #undef ETL_FILE -#ifdef ETL_COMPILER_MICROSOFT -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/include/etl/integral_limits.h b/include/etl/integral_limits.h index 4277d939..4adf9fad 100644 --- a/include/etl/integral_limits.h +++ b/include/etl/integral_limits.h @@ -37,10 +37,7 @@ SOFTWARE. #include "platform.h" #include "type_traits.h" -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#undef max -#endif +#include "private/minmax_push.h" //***************************************************************************** ///\defgroup integral_limits integral_limits @@ -213,9 +210,6 @@ namespace etl }; } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/include/etl/intrusive_forward_list.h b/include/etl/intrusive_forward_list.h index 9c8e0224..bcc24ddd 100644 --- a/include/etl/intrusive_forward_list.h +++ b/include/etl/intrusive_forward_list.h @@ -33,9 +33,7 @@ SOFTWARE. #include "platform.h" -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#endif +#include "private/minmax_push.h" #include #include @@ -1046,9 +1044,7 @@ namespace etl }; } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/intrusive_list.h b/include/etl/intrusive_list.h index 2d0e764c..6e4494d0 100644 --- a/include/etl/intrusive_list.h +++ b/include/etl/intrusive_list.h @@ -33,9 +33,7 @@ SOFTWARE. #include "platform.h" -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#endif +#include "private/minmax_push.h" #include #include @@ -1078,9 +1076,7 @@ namespace etl }; } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/list.h b/include/etl/list.h index 42aaaeb2..d48a6f5d 100644 --- a/include/etl/list.h +++ b/include/etl/list.h @@ -51,9 +51,7 @@ SOFTWARE. #include #endif -#ifdef ETL_COMPILER_MICROSOFT - #undef min -#endif +#include "private/minmax_push.h" #undef ETL_FILE #define ETL_FILE "7" @@ -1768,9 +1766,7 @@ bool operator >=(const etl::ilist& lhs, const etl::ilist& rhs) } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/map.h b/include/etl/map.h index 6f1908e0..4e7476fb 100644 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -51,9 +51,7 @@ SOFTWARE. #include #endif -#ifdef ETL_COMPILER_MICROSOFT - #undef min -#endif +#include "private/minmax_push.h" #undef ETL_FILE #define ETL_FILE "8" @@ -2186,9 +2184,7 @@ bool operator >=(const etl::imap& lhs, const etl::im return !(lhs < rhs); } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/multimap.h b/include/etl/multimap.h index 91aca760..e08e65dd 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -50,9 +50,7 @@ SOFTWARE. #include #endif -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#endif +#include "private/minmax_push.h" #undef ETL_FILE #define ETL_FILE "9" @@ -2071,9 +2069,7 @@ bool operator >=(const etl::imultimap& lhs, const et return !(lhs < rhs); } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/multiset.h b/include/etl/multiset.h index 4b6a74e0..47673ee5 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -50,9 +50,7 @@ SOFTWARE. #include #endif -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#endif +#include "private/minmax_push.h" #undef ETL_FILE #define ETL_FILE "10" @@ -2051,9 +2049,7 @@ bool operator >=(const etl::imultiset& lhs, const etl::imultiset=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "minmax_pop.h" #undef ETL_IN_PVOIDVECTOR diff --git a/include/etl/set.h b/include/etl/set.h index fe2f3eec..e405de30 100644 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -50,9 +50,7 @@ SOFTWARE. #include #endif -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#endif +#include "private/minmax_push.h" #undef ETL_FILE #define ETL_FILE "14" @@ -2109,9 +2107,7 @@ bool operator >=(const etl::iset& lhs, const etl::iset return !(lhs < rhs); } -#ifdef ETL_COMPILER_MICROSOFT -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/string_view.h b/include/etl/string_view.h index 0b376bb5..5402cda6 100644 --- a/include/etl/string_view.h +++ b/include/etl/string_view.h @@ -49,10 +49,7 @@ SOFTWARE. #undef ETL_FILE #define ETL_FILE "42" -#ifdef ETL_COMPILER_MICROSOFT -#undef min -#undef max -#endif +#include "private/minmax_push.h" namespace etl { @@ -864,10 +861,7 @@ void swap(etl::basic_string_view& lhs, etl::basic_string_view (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #undef ETL_FILE diff --git a/include/etl/u16string.h b/include/etl/u16string.h index 7380c786..f9c5d22f 100644 --- a/include/etl/u16string.h +++ b/include/etl/u16string.h @@ -39,9 +39,7 @@ SOFTWARE. #include #endif -#if defined(ETL_COMPILER_MICROSOFT) - #undef min -#endif +#include "private/minmax_push.h" namespace etl { @@ -231,8 +229,6 @@ namespace etl #endif } -#if defined(ETL_COMPILER_MICROSOFT) - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/include/etl/u32string.h b/include/etl/u32string.h index a1e2086d..23554cf4 100644 --- a/include/etl/u32string.h +++ b/include/etl/u32string.h @@ -39,9 +39,7 @@ SOFTWARE. #include #endif -#if defined(ETL_COMPILER_MICROSOFT) - #undef min -#endif +#include "private/minmax_push.h" namespace etl { @@ -231,8 +229,6 @@ namespace etl #endif } -#if defined(ETL_COMPILER_MICROSOFT) - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/include/etl/wstring.h b/include/etl/wstring.h index 8c7f8251..d3d6eb65 100644 --- a/include/etl/wstring.h +++ b/include/etl/wstring.h @@ -39,9 +39,7 @@ SOFTWARE. #include #endif -#if defined(ETL_COMPILER_MICROSOFT) - #undef min -#endif +#include "private/minmax_push.h" namespace etl { @@ -232,8 +230,6 @@ namespace etl #endif } -#if defined(ETL_COMPILER_MICROSOFT) - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "private/minmax_pop.h" #endif diff --git a/test/test_binary.cpp b/test/test_binary.cpp index 5689d400..5de74d2a 100644 --- a/test/test_binary.cpp +++ b/test/test_binary.cpp @@ -36,8 +36,6 @@ SOFTWARE. #include "fnv_1.h" #include "integral_limits.h" -#undef max - // Count bits the easy way. template size_t test_count(T value) diff --git a/test/test_bitset.cpp b/test/test_bitset.cpp index fa5b47ae..b3991918 100644 --- a/test/test_bitset.cpp +++ b/test/test_bitset.cpp @@ -34,9 +34,6 @@ SOFTWARE. #include "bitset.h" -#undef min -#undef max - namespace { SUITE(test_bitset) diff --git a/test/test_constant.cpp b/test/test_constant.cpp index f3c6dda9..6cd1587a 100644 --- a/test/test_constant.cpp +++ b/test/test_constant.cpp @@ -28,8 +28,6 @@ SOFTWARE. #include "UnitTest++.h" -#undef max - #include "constant.h" #include "integral_limits.h" diff --git a/test/test_integral_limits.cpp b/test/test_integral_limits.cpp index c48e6f37..8a23abf8 100644 --- a/test/test_integral_limits.cpp +++ b/test/test_integral_limits.cpp @@ -34,9 +34,6 @@ SOFTWARE. #include "integral_limits.h" -#undef min -#undef max - namespace { SUITE(test_integral_limits) diff --git a/test/test_string_char.cpp b/test/test_string_char.cpp index 9d0404f0..3d9aab80 100644 --- a/test/test_string_char.cpp +++ b/test/test_string_char.cpp @@ -35,8 +35,6 @@ SOFTWARE. #include "cstring.h" #include "fnv_1.h" -#undef min - #undef STR #define STR(x) x diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index 6d23555c..62de9237 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -34,8 +34,6 @@ SOFTWARE. #include "u16string.h" -#undef min - #undef STR #define STR(x) u##x diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index 8a608d4f..4cfd43f9 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -34,8 +34,6 @@ SOFTWARE. #include "u32string.h" -#undef min - #undef STR #define STR(x) U##x diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index c0c28a98..ff538896 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -34,8 +34,6 @@ SOFTWARE. #include "wstring.h" -#undef min - #undef STR #define STR(x) L##x