Skip to content

Commit 11e3aa8

Browse files
thugheskartben
authored andcommitted
tests: mgmt: mcumgr: Disable clang warning
When building with clang it reports: tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c:69:22: error: variable 'test_response_read_data_start' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] static const uint8_t test_response_read_data_start[5] = { ^ tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c:73:22: error: variable 'test_response_read_data_end' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] static const uint8_t test_response_read_data_end[1] = { ^ The values of test_response_read_data_start and test_response_read_data_end are not actually used anywhere in the tests. Signed-off-by: Tom Hughes <tomhughes@chromium.org>
1 parent e31d3c3 commit 11e3aa8

File tree

2 files changed

+9
-1
lines changed
  • include/zephyr/toolchain
  • tests/subsys/mgmt/mcumgr/settings_mgmt/src

2 files changed

+9
-1
lines changed

include/zephyr/toolchain/llvm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030

3131
#include <zephyr/toolchain/gcc.h>
3232

33-
#define TOOLCHAIN_WARNING_SIZEOF_ARRAY_DECAY "-Wsizeof-array-decay"
33+
#define TOOLCHAIN_WARNING_SIZEOF_ARRAY_DECAY "-Wsizeof-array-decay"
34+
#define TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION "-Wunneeded-internal-declaration"
3435

3536
#define TOOLCHAIN_DISABLE_CLANG_WARNING(warning) _TOOLCHAIN_DISABLE_WARNING(clang, warning)
3637
#define TOOLCHAIN_ENABLE_CLANG_WARNING(warning) _TOOLCHAIN_ENABLE_WARNING(clang, warning)

tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,20 @@ static const uint8_t test_response_error_data[8] = {
6666
0xbf, 0x62, 0x72, 0x63, 0x19, 0x01, 0x00, 0xff
6767
};
6868

69+
/*
70+
* TODO: The contents of these structs are not used, which is why clang complains.
71+
* The test should be updated to use these values. See discussion in
72+
* https://github.com/zephyrproject-rtos/zephyr/pull/87592.
73+
*/
74+
TOOLCHAIN_DISABLE_CLANG_WARNING(TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION)
6975
static const uint8_t test_response_read_data_start[5] = {
7076
0xbf, 0x63, 0x76, 0x61, 0x6c
7177
};
7278

7379
static const uint8_t test_response_read_data_end[1] = {
7480
0xff
7581
};
82+
TOOLCHAIN_ENABLE_CLANG_WARNING(TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION)
7683

7784
static void cleanup_test(void *p)
7885
{

0 commit comments

Comments
 (0)