Re: [PATCH 4/5] testsuite/smokey/psostests: Fix compile error seen with gcc 16

Jan Kiszka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
On 13.05.26 14:50, Florian Bezdeka wrote:
> Fixes the following compile errors:
> 
> rn-1.c: In function ‘alloc_task’:
> rn-1.c:16:18: error: variable ‘n’ set but not used [-Werror=unused-but-set-variable=]
>    16 |         int ret, n;
>       |                  ^
> rn-1.c:15:22: error: variable ‘alloc_size’ set but not used [-Werror=unused-but-set-variable=]
>    15 |         u_long size, alloc_size = 0;
>       |
> 
> task-2.c: In function ‘backgroundTask’:
> task-2.c:19:42: error: variable ‘count’ set but not used [-Werror=unused-but-set-variable=]
>    19 |         unsigned int safety = 100000000, count = 0;
>       |                                          ^~~~~
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Florian Bezdeka <[email protected]>
> ---
>  testsuite/smokey/psostests/rn-1.c   | 7 +++----
>  testsuite/smokey/psostests/task-2.c | 5 ++---
>  2 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/testsuite/smokey/psostests/rn-1.c b/testsuite/smokey/psostests/rn-1.c
> index 5e82d1506ca029ae2bf812ccbfbf9c3a9ab9cc7e..d2e847375212c9746de3e550a5d10a8be4694de5 100644
> --- a/testsuite/smokey/psostests/rn-1.c
> +++ b/testsuite/smokey/psostests/rn-1.c
> @@ -12,15 +12,15 @@ static u_long tid, rnid;
>  
>  static void alloc_task(u_long a1, u_long a2, u_long a3, u_long a4)
>  {
> -	u_long size, alloc_size = 0;
> -	int ret, n;
> +	u_long size;
>  	void *buf;
> +	int ret;
>  
>  	traceobj_enter(&trobj);
>  
>  	srandom(0x11223344);
>  
> -	for (n = 0;; n++) {
> +	for (;;) {
>  		size = (random() % (sizeof(rn_mem) / 8)) + 4;
>  		ret = rn_getseg(rnid, size, RN_NOWAIT, 0, &buf);
>  		if (ret) {
> @@ -28,7 +28,6 @@ static void alloc_task(u_long a1, u_long a2, u_long a3, u_long a4)
>  			break;
>  		}
>  		memset(buf, 0xaa, size);
> -		alloc_size += size;
>  	}
>  
>  	traceobj_exit(&trobj);

A ... non-obvious test, but it looks like those vars really never
contributed anything to it.

> diff --git a/testsuite/smokey/psostests/task-2.c b/testsuite/smokey/psostests/task-2.c
> index d24c13465367c7c2a6975dd4cbb01eb75f8fd1ad..dfe9724a8325b821a13c34c9ddaa3aa4a0e37073 100644
> --- a/testsuite/smokey/psostests/task-2.c
> +++ b/testsuite/smokey/psostests/task-2.c
> @@ -16,7 +16,7 @@ static u_long sem_id;
>  
>  static void backgroundTask(u_long a1, u_long a2, u_long a3, u_long a4)
>  {
> -	unsigned int safety = 100000000, count = 0;
> +	unsigned int safety = 100000000;
>  	int ret;
>  
>  	traceobj_enter(&trobj);
> @@ -28,8 +28,7 @@ static void backgroundTask(u_long a1, u_long a2, u_long a3, u_long a4)
>  
>  	traceobj_mark(&trobj, 2);
>  
> -	while (--safety > 0)
> -		count++;
> +	while (--safety > 0) {}
>  

Same comment as for patch 3.

Jan

>  	traceobj_mark(&trobj, 3);
>  
> 


-- 
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.