Skip to content

Commit 670d4e0

Browse files
committed
tests/unit-test.h.in: satisfy some compilers that UT_BITS_ADDRESS_INVALID_REQUEST_LENGTH is initialized correctly with constexpr
Signed-off-by: Jim Klimov <[email protected]>
1 parent 161c40f commit 670d4e0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/unit-test.h.in

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@
2727
#define SERVER_ID 17
2828
#define INVALID_SERVER_ID 18
2929

30-
const uint16_t UT_BITS_ADDRESS = 0x130;
30+
/* https://stackoverflow.com/a/3025142/4715872
31+
* ...in section 6.6, the spec defines what must considered
32+
* a constant expression. No where does it state that a
33+
* const variable must be considered a constant expression.
34+
* It is legal for a compiler to extend this...
35+
*/
36+
#define UT_BITS_ADDRESS_VAL 0x130
37+
const uint16_t UT_BITS_ADDRESS = UT_BITS_ADDRESS_VAL;
3138
const uint16_t UT_BITS_NB = 0x25;
3239
const uint8_t UT_BITS_TAB[] = { 0xCD, 0x6B, 0xB2, 0x0E, 0x1B };
33-
const uint16_t UT_BITS_ADDRESS_INVALID_REQUEST_LENGTH = UT_BITS_ADDRESS + 2;
40+
const uint16_t UT_BITS_ADDRESS_INVALID_REQUEST_LENGTH = UT_BITS_ADDRESS_VAL + 2;
3441

3542
const uint16_t UT_INPUT_BITS_ADDRESS = 0x1C4;
3643
const uint16_t UT_INPUT_BITS_NB = 0x16;

0 commit comments

Comments
 (0)