Re: [PATCH v3 3/4] testsuite/smokey/vxworktests: Fix compile error seen with gcc 16

Jan Kiszka <[email protected]> Mon, 20 Jul 2026 16:38:21 +0200
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
On 17.07.26 09:45, Florian Bezdeka wrote:
> 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 taskDelay(), 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 | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/testsuite/smokey/vxworkstests/task-2.c b/testsuite/smokey/vxworkstests/task-2.c
> index 0cbb9e18a13383418c4360241ef244b8a24da975..feda4ff7054346331de0b0cf8f6d53bd07e04c02 100644
> --- a/testsuite/smokey/vxworkstests/task-2.c
> +++ b/testsuite/smokey/vxworkstests/task-2.c
> @@ -23,7 +23,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 +34,7 @@ static void backgroundTask(long arg, ...)
>  
>  	traceobj_mark(&trobj, 2);
>  
> -	while (--safety > 0)
> -		count++;
> +	taskDelay(5);

That is not the same, you rather want threadobj_spin to avoid that the
task is only caught while sleeping.

Jan

-- 
Siemens AG, Foundational Technologies
Linux Expert Center