Skip to content

Commit 70c947d

Browse files
committed
fixup macro name to reflect logic
1 parent fc0dc29 commit 70c947d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cores/nRF5/common_func.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040

4141
#ifdef __cplusplus
42+
// namespace and templates must be outside the `extern "C"` declaration...
4243
namespace ADAFRUIT_DETAIL
4344
{
4445
template <typename T, size_t N>
@@ -53,8 +54,8 @@
5354
#elif __STDC_VERSION__ >= 201112L
5455
// Even C can have type-safety for equivalent of ARRAY_SIZE() macro, when using GCC (which this BSP does)
5556
#define __ADA_COMPATIBLE_TYPES(a,b) __builtin_types_compatible_p(typeof(a), typeof(b)) // GCC extensions
56-
#define __ADA_BUILD_ERROR_ON_ZERO(x) (sizeof(struct { int:-!!(x)*0x1ee7;})) // if x is zero, reports "error: negative width in bit-field '<anonymous>'"
57-
#define __ADA_MUST_BE_ARRAY(x) __ADA_BUILD_ERROR_ON_ZERO(__ADA_COMPATIBLE_TYPES((x), &(*x)))
57+
#define __ADA_BUILD_ERROR_IF_NONZERO(x) (sizeof(struct { int:-!!(x)*0x1ee7;})) // if x is zero, reports "error: negative width in bit-field '<anonymous>'"
58+
#define __ADA_MUST_BE_ARRAY(x) __ADA_BUILD_ERROR_IF_NONZERO(__ADA_COMPATIBLE_TYPES((x), &(*x)))
5859
#define ADA_STATIC_ASSERT(const_expr, message) _Static_assert(const_expr, message)
5960
#define arrcount(_arr) ( (sizeof(_arr) / sizeof((_arr)[0])) + __ADA_MUST_BE_ARRAY(_arr) ) // compile-time error if not an array
6061
#else

0 commit comments

Comments
 (0)