diff --git a/samples/drivers/soc_flash_nrf/src/main.c b/samples/drivers/soc_flash_nrf/src/main.c index b85ce619724fc..3eaa5c407c55e 100644 --- a/samples/drivers/soc_flash_nrf/src/main.c +++ b/samples/drivers/soc_flash_nrf/src/main.c @@ -155,8 +155,8 @@ void main(void) if (!rc) { printf(" Offset 0x%08x:\n", FLASH_TEST_OFFSET2); - printf(" belongs to the page %u of start offset 0x%08x\n", - info.index, info.start_offset); + printf(" belongs to the page %u of start offset 0x%08lx\n", + info.index, (unsigned long) info.start_offset); printf(" and the size of 0x%08x B.\n", info.size); } else { printf(" Error: flash_get_page_info_by_offs returns %d\n", @@ -166,9 +166,9 @@ void main(void) rc = flash_get_page_info_by_idx(flash_dev, FLASH_TEST_PAGE_IDX, &info); if (!rc) { - printf(" Page of number %u has start offset 0x%08x\n", + printf(" Page of number %u has start offset 0x%08lx\n", FLASH_TEST_PAGE_IDX, - info.start_offset); + (unsigned long) info.start_offset); printf(" and size of 0x%08x B.\n", info.size); if (info.index == FLASH_TEST_PAGE_IDX) { printf(" Page index resolved properly\n"); diff --git a/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt.c index c32b98c8fda3e..3f158ecdf265a 100644 --- a/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt_state.c index ec6a98f80940d..bb11cdf08b28b 100644 --- a/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt_state.c @@ -6,6 +6,7 @@ #include #include +#include #include #include diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index fa6f502081372..fcdbbfb1a0e01 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -43,10 +43,10 @@ struct spi_cs_control spi_cs = { #define BUF2_SIZE 36 #if CONFIG_NOCACHE_MEMORY -static const char tx_data[] = "0123456789abcdef\0"; +static const char tx_data[BUF_SIZE] = "0123456789abcdef\0"; static __aligned(32) char buffer_tx[BUF_SIZE] __used __attribute__((__section__(".nocache"))); static __aligned(32) char buffer_rx[BUF_SIZE] __used __attribute__((__section__(".nocache"))); -static const char tx2_data[] = "Thequickbrownfoxjumpsoverthelazydog\0"; +static const char tx2_data[BUF2_SIZE] = "Thequickbrownfoxjumpsoverthelazydog\0"; static __aligned(32) char buffer2_tx[BUF2_SIZE] __used __attribute__((__section__(".nocache"))); static __aligned(32) char buffer2_rx[BUF2_SIZE] __used __attribute__((__section__(".nocache"))); #else diff --git a/tests/kernel/common/src/errno.c b/tests/kernel/common/src/errno.c index 8c76edca71ed8..3d1f2886a22f9 100644 --- a/tests/kernel/common/src/errno.c +++ b/tests/kernel/common/src/errno.c @@ -7,6 +7,7 @@ #include #include #include +#include /** * @brief Test the thread context diff --git a/tests/lib/c_lib/src/test_qsort.c b/tests/lib/c_lib/src/test_qsort.c index 44b8e9019aa3a..d90fd75fa16c5 100644 --- a/tests/lib/c_lib/src/test_qsort.c +++ b/tests/lib/c_lib/src/test_qsort.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define _GNU_SOURCE #include #include #include diff --git a/tests/lib/mem_alloc/src/main.c b/tests/lib/mem_alloc/src/main.c index a3b7b8b48f61e..37924459bf143 100644 --- a/tests/lib/mem_alloc/src/main.c +++ b/tests/lib/mem_alloc/src/main.c @@ -16,6 +16,15 @@ * it guarantee that ALL functionality provided is working correctly. */ +#if defined(__GNUC__) +/* + * Don't complain about ridiculous alloc size requests + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Walloc-size-larger-than=" +#endif + +#define _BSD_SOURCE #include #include #include