From 955af32b1ce7e461e0231ab6f686d5e60916fdc0 Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Wed, 24 Feb 2016 13:25:43 +0000 Subject: [PATCH] systemlib: properly check for MULT_COUNT value Checking with preprocessor directives doesn't have any effect because MULT_COUNT is an enum value rather than a macro. Thus, since MULT_COUNT is undefined from the preprocessor perspective, even if the number of items in `enum MULT_PORTS` (except MULT_COUNT) was greater than 33, the error wouldn't be raised. --- src/modules/systemlib/systemlib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/systemlib/systemlib.h b/src/modules/systemlib/systemlib.h index 29b6eb5cef..06e84c751d 100644 --- a/src/modules/systemlib/systemlib.h +++ b/src/modules/systemlib/systemlib.h @@ -55,9 +55,9 @@ enum MULT_PORTS { MULT_COUNT }; +#if defined(__cplusplus) /* Check max multi port count */ -#if (MULT_COUNT > 33) -#error "MULT_COUNT HAS TO BE LESS THAN OR EQUAL 33" +static_assert(MULT_COUNT <= 33, "MULT_COUNT HAS TO BE LESS THAN OR EQUAL 33"); #endif /* FMU board info, to be stored in the first 64 bytes of the FMU EEPROM */