Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable erroneous warnings from clang #87498

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/zephyr/toolchain/llvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

#include <zephyr/toolchain/gcc.h>

#define TOOLCHAIN_WARNING_SIZEOF_ARRAY_DECAY "-Wsizeof-array-decay"
#define TOOLCHAIN_WARNING_SIZEOF_ARRAY_DECAY "-Wsizeof-array-decay"
#define TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION "-Wunneeded-internal-declaration"

#define TOOLCHAIN_DISABLE_CLANG_WARNING(warning) _TOOLCHAIN_DISABLE_WARNING(clang, warning)
#define TOOLCHAIN_ENABLE_CLANG_WARNING(warning) _TOOLCHAIN_ENABLE_WARNING(clang, warning)
Expand Down
3 changes: 3 additions & 0 deletions tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ static const uint8_t test_response_error_data[8] = {
0xbf, 0x62, 0x72, 0x63, 0x19, 0x01, 0x00, 0xff
};

/* Disable erroneous clang warning: https://github.com/llvm/llvm-project/issues/25458. */
TOOLCHAIN_DISABLE_CLANG_WARNING(TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION)
static const uint8_t test_response_read_data_start[5] = {
0xbf, 0x63, 0x76, 0x61, 0x6c
};

static const uint8_t test_response_read_data_end[1] = {
0xff
};
TOOLCHAIN_ENABLE_CLANG_WARNING(TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION)

static void cleanup_test(void *p)
{
Expand Down
3 changes: 3 additions & 0 deletions tests/subsys/usb/bos/src/test_bos.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ LOG_MODULE_REGISTER(test_main, LOG_LEVEL_DBG);
* Compare old style USB BOS definition with section aligned
*/

/* Disable erroneous clang warning: https://github.com/llvm/llvm-project/issues/25458. */
TOOLCHAIN_DISABLE_CLANG_WARNING(TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION)
static const uint8_t dummy_descriptor[] = {
0x00, 0x01, 0x02
};
TOOLCHAIN_ENABLE_CLANG_WARNING(TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION)

static struct webusb_bos_desc {
struct usb_bos_descriptor bos;
Expand Down
Loading