From b45d6d6a769cf488ffd360d3666f471bf575fc0b Mon Sep 17 00:00:00 2001 From: Maciej Bocianski Date: Fri, 30 Aug 2019 09:36:37 +0200 Subject: [PATCH] queue test: add counter overflow protect without this fix test_equeue_break_no_windup was failing on IAR --- TESTS/events/equeue/main.cpp | 5 ++++- UNITTESTS/events/equeue/test_equeue.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/TESTS/events/equeue/main.cpp b/TESTS/events/equeue/main.cpp index 79ed14caa5f..98288859fbf 100644 --- a/TESTS/events/equeue/main.cpp +++ b/TESTS/events/equeue/main.cpp @@ -39,7 +39,10 @@ static void pass_func(void *eh) static void simple_func(void *p) { - (*(reinterpret_cast(p)))++; + uint8_t *d = reinterpret_cast(p); + if (*d < 255) { + (*d)++; + } } static void sloth_func(void *p) diff --git a/UNITTESTS/events/equeue/test_equeue.cpp b/UNITTESTS/events/equeue/test_equeue.cpp index 0fab6e94195..cb93134b281 100644 --- a/UNITTESTS/events/equeue/test_equeue.cpp +++ b/UNITTESTS/events/equeue/test_equeue.cpp @@ -45,7 +45,10 @@ static void pass_func(void *eh) static void simple_func(void *p) { - (*(reinterpret_cast(p)))++; + uint8_t *d = reinterpret_cast(p); + if (*d < 255) { + (*d)++; + } } static void sloth_func(void *p)