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

Jan Kiszka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
On 18.05.26 11:02, 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 - to my understanding - is keeping the background
> task alive, so that the foreground task is able to call taskSuspend()
> for the background task.
> 
> As the background task is calling safe_pause(), the task will wait
> for the termination signal anyhow, so busy waiting upfront is not
> necessary.

It remains unclear, though, what the test scope of task-2 is here. The
busy loop keeps background in primary mode, foreground interrupting it
due to higher prio once the delay ended. In contract, pause() should
kick background out of primary and let it block in Linux. So, if the
test is (also) about deleting a suspended task in primary mode, then
this change would destroy that case.

Alternatively, you could spin in primary mode for at least 3 vxworks
ticks, likely some more to be safe.

Jan

> 
> Signed-off-by: Florian Bezdeka <[email protected]>
> ---
>  testsuite/smokey/vxworkstests/task-2.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/testsuite/smokey/vxworkstests/task-2.c b/testsuite/smokey/vxworkstests/task-2.c
> index 0cbb9e18a13383418c4360241ef244b8a24da975..60462e64ea7b2b4ddc810f336eea906cf6ca8c8f 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,9 +34,6 @@ static void backgroundTask(long arg, ...)
>  
>  	traceobj_mark(&trobj, 2);
>  
> -	while (--safety > 0)
> -		count++;
> -
>  	/*
>  	 * Enter infinite pause so that any pending cancellation is
>  	 * taken regardless of whether async-cancel is enabled or not.
> 


-- 
Siemens AG, Foundational Technologies
Linux Expert Center
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.