mirror of https://github.com/ARMmbed/mbed-os.git
ns_list: avoid UINT_FAST8_MAX
Prevent compilation issues when someone has included <stdint.h> before a header file that needs to include <ns_list.h>. Some toolchains like ARM C 5 will not provide UINT_FAST8_MAX in C++ unless __STDC_LIMIT_MACROS is defined, and if this was not defined the first time <stdint.h> was included, it's too late. We can get the maximum value for our unsigned list offset by casting -1 to it, thanks to modulo arithmetic.pull/10809/head
parent
09ea361c7e
commit
5c3b15cf81
|
|
@ -148,7 +148,7 @@ union \
|
|||
{ \
|
||||
ns_list_t slist; \
|
||||
NS_FUNNY_COMPARE_OK \
|
||||
NS_STATIC_ASSERT(link_offset <= UINT_FAST8_MAX, "link offset too large") \
|
||||
NS_STATIC_ASSERT(link_offset <= (ns_list_offset_t) -1, "link offset too large") \
|
||||
NS_FUNNY_COMPARE_RESTORE \
|
||||
char (*offset)[link_offset + 1]; \
|
||||
entry_type *type; \
|
||||
|
|
|
|||
Loading…
Reference in New Issue