Espen - 2023-08-14

Hi. I get several style warnings.
in a file called https_client .h I have

#define HTTPS_DATA_BLOCK_SIZE (256U)

I include this header file and try to create an array with the macro as the size

#include "https_client.h"
uint8_t temp_arr[HTTPS_DATA_BLOCK_SIZE * 2U] = {0};

And cppcheck version 2.9 gives me this warning

components/https_startup/https_startup.c:227:13: style: Variable-length array types shall not be used Overlapping storage [misra-c2012-18.8]
    uint8_t temp_arr[HTTPS_DATA_BLOCK_SIZE * 2U] = {0};

My compiler options are set to

-Wall\
            -Wextra\
            -Wmissing-braces\
            -Wmissing-field-initializers\
            -Wswitch-default\
            -Wimplicit-fallthrough=3\
            -Wpointer-arith\
            -Wbad-function-cast\
            -Wstrict-aliasing=3\
            -Wstrict-overflow=5\
            -Wformat=2\
            -Wformat-security\
            -Wformat-signedness\
            -Wformat-overflow=2\
            -Wformat-truncation=2\
            -Wshift-overflow=2\
            -Wshadow\
            -Wcast-qual\
            -Wcast-align\
            -Wnested-externs\
            -Wunreachable-code\
            -Wlogical-op\
            -Wfloat-equal\
            -Wdouble-promotion\
            -Wconversion\
            -Warith-conversion\
            -Wstrict-prototypes\
            -Wmissing-prototypes\
            -Wundef\
            -Wuninitialized\
            -Winit-self\
            -Wduplicated-branches\
            -Wduplicated-cond\
            -Wvla\
            -Walloc-zero\
            -Wparentheses\

And I use CMake to build the project.

I have done the same in multiple other files without getting this warning.

 

Last edit: Espen 2023-08-14