Skip to content

Commit 1fe6a7c

Browse files
ianbraultIan Braultbocchino
authored
Account for string length serialization in static asserts (#3937)
Co-authored-by: Ian Brault <[email protected]> Co-authored-by: Rob Bocchino <[email protected]>
1 parent 0b92e8e commit 1fe6a7c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Fw/FPrimeBasicTypes.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ static_assert(FW_FIXED_LENGTH_STRING_SIZE >= FW_PARAM_STRING_MAX_SIZE,
4646

4747
// Check that command/telemetry strings are not larger than an argument buffer
4848

49-
static_assert(FW_CMD_STRING_MAX_SIZE <= FW_CMD_ARG_BUFFER_MAX_SIZE,
49+
static_assert(FW_CMD_STRING_MAX_SIZE + sizeof(FwSizeStoreType) <= FW_CMD_ARG_BUFFER_MAX_SIZE,
5050
"FW_CMD_STRING_MAX_SIZE cannot be larger than FW_CMD_ARG_BUFFER_MAX_SIZE");
51-
static_assert(FW_LOG_STRING_MAX_SIZE <= FW_LOG_BUFFER_MAX_SIZE,
51+
static_assert(FW_LOG_STRING_MAX_SIZE + sizeof(FwSizeStoreType) <= FW_LOG_BUFFER_MAX_SIZE,
5252
"FW_LOG_STRING_MAX_SIZE cannot be larger than FW_LOG_BUFFER_MAX_SIZE");
53-
static_assert(FW_TLM_STRING_MAX_SIZE <= FW_TLM_BUFFER_MAX_SIZE,
53+
static_assert(FW_TLM_STRING_MAX_SIZE + sizeof(FwSizeStoreType) <= FW_TLM_BUFFER_MAX_SIZE,
5454
"FW_TLM_STRING_MAX_SIZE cannot be larger than FW_TLM_BUFFER_MAX_SIZE");
55-
static_assert(FW_PARAM_STRING_MAX_SIZE <= FW_PARAM_BUFFER_MAX_SIZE,
55+
static_assert(FW_PARAM_STRING_MAX_SIZE + sizeof(FwSizeStoreType) <= FW_PARAM_BUFFER_MAX_SIZE,
5656
"FW_PARAM_STRING_MAX_SIZE cannot be larger than FW_PARAM_BUFFER_MAX_SIZE");
5757

5858
// Text logging needs the code generator for serializables to generate a stringified version of the
@@ -79,7 +79,7 @@ static_assert(sizeof(PlatformPointerCastType) == sizeof(void*), "PlatformPointer
7979
static_assert(std::numeric_limits<PlatformSizeType>::max() >= std::numeric_limits<unsigned int>::max(),
8080
"PlatformSizeType must be at least as large as unsigned int");
8181
static_assert(std::numeric_limits<PlatformSignedSizeType>::max() >= std::numeric_limits<int>::max(),
82-
"PlatformSignedSizeType must be at least as large as int");
82+
"PlatformSignedSizeType must be at least as large as int");
8383
static_assert(std::numeric_limits<PlatformSignedSizeType>::min() <= std::numeric_limits<int>::min(),
8484
"PlatformSignedSizeType must be at least as small as int");
8585
static_assert(std::numeric_limits<PlatformIndexType>::is_signed, "PlatformIndexType must be signed");
@@ -92,7 +92,7 @@ static_assert(sizeof(PlatformSizeType) == sizeof(PlatformSignedSizeType), "Platf
9292
static_assert(std::numeric_limits<FwSizeType>::max() >= std::numeric_limits<unsigned int>::max(),
9393
"FwSizeType must be at least as large as unsigned int");
9494
static_assert(std::numeric_limits<FwSignedSizeType>::max() >= std::numeric_limits<int>::max(),
95-
"FwSignedSizeType must be at least as large as int");
95+
"FwSignedSizeType must be at least as large as int");
9696
static_assert(std::numeric_limits<FwSignedSizeType>::min() <= std::numeric_limits<int>::min(),
9797
"FwSignedSizeType must be at least as large as int");
9898
static_assert(std::numeric_limits<FwIndexType>::is_signed, "FwIndexType must be signed");

0 commit comments

Comments
 (0)