Re: [PATCH v2 4/4] testsuite/smokey/psostests: 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 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 > > The counting busy loop has been replaced by an interval based busy > loop. > > 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); > diff --git a/testsuite/smokey/psostests/task-2.c b/testsuite/smokey/psostests/task-2.c > index d24c13465367c7c2a6975dd4cbb01eb75f8fd1ad..be1b6ca18c5354ba092d55b3655bae9a294f2ce7 100644 > --- a/testsuite/smokey/psostests/task-2.c > +++ b/testsuite/smokey/psostests/task-2.c > @@ -2,6 +2,7 @@ > #include <stdio.h> > #include <stdlib.h> > #include <copperplate/traceobj.h> > +#include <copperplate/threadobj.h> > #include <psos/psos.h> > > static struct traceobj trobj; > @@ -16,7 +17,6 @@ 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; > 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++; > + threadobj_spin(1000); That's just 1 µs, isn't it? That sounds rather short, not only for VM setups. Jan > > traceobj_mark(&trobj, 3); > > -- Siemens AG, Foundational Technologies Linux Expert Center