You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2023/10/06 12:43:25 UTC
[mynewt-core] 01/02: hw/mcu: Fix compilation with ARM GCC 13
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 25cd4af362b87433486b834d71beb11247016276
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Fri Oct 6 08:42:10 2023 +0200
hw/mcu: Fix compilation with ARM GCC 13
multiple hal_timer_stop() implementations follow same pattern which
seems to trigger false-positive (ie entry cannot be used uninitialized
here) with ARM GCC 13.2
Compiling repos/apache-mynewt-core/kernel/os/src/os_error.c
Error: repos/apache-mynewt-core/hw/mcu/nordic/nrf5340/src/hal_timer.c:
In function 'hal_timer_stop':
repos/apache-mynewt-core/hw/mcu/nordic/nrf5340/src/hal_timer.c:885:17:
error: 'entry' may be used uninitialized [-Werror=maybe-uninitialized]
885 | nrf_timer_set_ocmp((struct nrf5340_hal_timer *)
entry->bsp_timer,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
886 | entry->expiry);
| ~~~~~~~~~~~~~~
repos/apache-mynewt-core/hw/mcu/nordic/nrf5340/src/hal_timer.c:863:23:
note: 'entry' was declared here
863 | struct hal_timer *entry;
---
hw/mcu/native/src/hal_timer.c | 2 +-
hw/mcu/nordic/nrf51xxx/src/hal_timer.c | 2 +-
hw/mcu/nordic/nrf52xxx/src/hal_timer.c | 2 +-
hw/mcu/nordic/nrf5340/src/hal_timer.c | 2 +-
hw/mcu/nordic/nrf5340_net/src/hal_timer.c | 2 +-
hw/mcu/nordic/nrf91xx/src/hal_timer.c | 2 +-
hw/mcu/nxp/kinetis/src/hal_timer.c | 2 +-
hw/mcu/stm/stm32_common/src/hal_timer.c | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/mcu/native/src/hal_timer.c b/hw/mcu/native/src/hal_timer.c
index 098ab8ddd..77d3d0efe 100644
--- a/hw/mcu/native/src/hal_timer.c
+++ b/hw/mcu/native/src/hal_timer.c
@@ -331,7 +331,7 @@ int
hal_timer_stop(struct hal_timer *timer)
{
struct native_timer *nt;
- struct hal_timer *ht;
+ struct hal_timer *ht = NULL;
int reset_ocmp;
os_sr_t sr;
diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_timer.c b/hw/mcu/nordic/nrf51xxx/src/hal_timer.c
index a99be65cb..abcd7a9a4 100644
--- a/hw/mcu/nordic/nrf51xxx/src/hal_timer.c
+++ b/hw/mcu/nordic/nrf51xxx/src/hal_timer.c
@@ -939,7 +939,7 @@ hal_timer_stop(struct hal_timer *timer)
{
uint32_t ctx;
int reset_ocmp;
- struct hal_timer *entry;
+ struct hal_timer *entry = NULL;
struct nrf51_hal_timer *bsptimer;
if (timer == NULL) {
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_timer.c b/hw/mcu/nordic/nrf52xxx/src/hal_timer.c
index fc6fe834d..75dec3c38 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_timer.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_timer.c
@@ -908,7 +908,7 @@ hal_timer_stop(struct hal_timer *timer)
{
uint32_t ctx;
int reset_ocmp;
- struct hal_timer *entry;
+ struct hal_timer *entry = NULL;
struct nrf52_hal_timer *bsptimer;
if (timer == NULL) {
diff --git a/hw/mcu/nordic/nrf5340/src/hal_timer.c b/hw/mcu/nordic/nrf5340/src/hal_timer.c
index cdc6c1ed0..082567b9c 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_timer.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_timer.c
@@ -860,7 +860,7 @@ hal_timer_stop(struct hal_timer *timer)
{
uint32_t ctx;
int reset_ocmp;
- struct hal_timer *entry;
+ struct hal_timer *entry = NULL;
struct nrf5340_hal_timer *bsptimer;
if (timer == NULL) {
diff --git a/hw/mcu/nordic/nrf5340_net/src/hal_timer.c b/hw/mcu/nordic/nrf5340_net/src/hal_timer.c
index 06884c61b..9f6701520 100644
--- a/hw/mcu/nordic/nrf5340_net/src/hal_timer.c
+++ b/hw/mcu/nordic/nrf5340_net/src/hal_timer.c
@@ -860,7 +860,7 @@ hal_timer_stop(struct hal_timer *timer)
{
uint32_t ctx;
int reset_ocmp;
- struct hal_timer *entry;
+ struct hal_timer *entry = NULL;
struct nrf5340_hal_timer *bsptimer;
if (timer == NULL) {
diff --git a/hw/mcu/nordic/nrf91xx/src/hal_timer.c b/hw/mcu/nordic/nrf91xx/src/hal_timer.c
index 61f87a10e..5547a3281 100644
--- a/hw/mcu/nordic/nrf91xx/src/hal_timer.c
+++ b/hw/mcu/nordic/nrf91xx/src/hal_timer.c
@@ -894,7 +894,7 @@ hal_timer_stop(struct hal_timer *timer)
{
uint32_t ctx;
int reset_ocmp;
- struct hal_timer *entry;
+ struct hal_timer *entry = NULL;
struct nrf91_hal_timer *bsptimer;
if (timer == NULL) {
diff --git a/hw/mcu/nxp/kinetis/src/hal_timer.c b/hw/mcu/nxp/kinetis/src/hal_timer.c
index 4fadd01a2..58cc02e3e 100644
--- a/hw/mcu/nxp/kinetis/src/hal_timer.c
+++ b/hw/mcu/nxp/kinetis/src/hal_timer.c
@@ -405,7 +405,7 @@ int
hal_timer_stop(struct hal_timer *timer)
{
struct kinetis_hal_tmr *tmr;
- struct hal_timer *entry;
+ struct hal_timer *entry = NULL;
bool reset_period;
os_sr_t sr;
diff --git a/hw/mcu/stm/stm32_common/src/hal_timer.c b/hw/mcu/stm/stm32_common/src/hal_timer.c
index e5f4ed7ac..b7c220674 100644
--- a/hw/mcu/stm/stm32_common/src/hal_timer.c
+++ b/hw/mcu/stm/stm32_common/src/hal_timer.c
@@ -784,7 +784,7 @@ int
hal_timer_stop(struct hal_timer *timer)
{
struct stm32_hal_tmr *tmr;
- struct hal_timer *ht;
+ struct hal_timer *ht = NULL;
int sr;
int reset_ocmp;