[PATCH v4 1/3] testsuite/smokey/vxworktests: Fix compile error seen with gcc 16
Florian Bezdeka <[email protected]> Mon, 20 Jul 2026 23:28:25 +0200
| Newsgroups | dev.linux.lists.xenomai |
|---|---|
| Message-ID | <[email protected]> |
Fixes the following error:
task-2.c: In function ‘backgroundTask’:
task-2.c:26:42: error: variable ‘count’ set but not used [-Werror=unused-but-set-variable=]
26 | unsigned int safety = 100000000, count = 0;
| ^~~~~
cc1: all warnings being treated as errors
The busy waiting loop is keeping the background task alive, so that
the foreground task is able to call taskSuspend() for the background
task.
Replacing the counting busy loop with a call to threadobj_spin(), which
will be time based. We will stay in the RT domain while waiting, so that
taskSuspend() is called for a task part of the RT domain.
Signed-off-by: Florian Bezdeka <[email protected]>
---
testsuite/smokey/vxworkstests/task-2.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/testsuite/smokey/vxworkstests/task-2.c b/testsuite/smokey/vxworkstests/task-2.c
index 0cbb9e18a13383418c4360241ef244b8a24da975..d701394dda9d340fb59a7a96ce6e1ea620ca0212 100644
--- a/testsuite/smokey/vxworkstests/task-2.c
+++ b/testsuite/smokey/vxworkstests/task-2.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <stdlib.h>
#include <unistd.h>
+#include <copperplate/threadobj.h>
#include <copperplate/traceobj.h>
#include <vxworks/errnoLib.h>
#include <vxworks/semLib.h>
@@ -23,7 +24,6 @@ static SEM_ID sem_id, fdone_sem_id;
static void backgroundTask(long arg, ...)
{
- unsigned int safety = 100000000, count = 0;
int ret;
traceobj_enter(&trobj);
@@ -35,8 +35,7 @@ static void backgroundTask(long arg, ...)
traceobj_mark(&trobj, 2);
- while (--safety > 0)
- count++;
+ threadobj_spin(2000000);
/*
* Enter infinite pause so that any pending cancellation is
--
2.55.0