public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] pthread_barrier_init: remove the restrict limit
@ 2022-10-18  3:22 Li Wang
  2022-10-18  8:48 ` Richard Palethorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2022-10-18  3:22 UTC (permalink / raw)
  To: ltp; +Cc: rpalethorpe

The restrict keyword tells the compiler that a given pointer
does not alias any other pointer in the same context. But this
is only supported by C99.

To make older platforms compilinng LTP successful, we have to cancel
that limitation in function definition.

Fix error: https://github.com/linux-test-project/ltp/actions/runs/3263823142/jobs/5363481739

Signed-off-by: Li Wang <liwang@redhat.com>
---

Notes:
      I also considering adding "-std=gun99" for compiling the whole library,
      but not sure if this could bring a bigger potential impact on LTP.

 include/tst_safe_pthread.h | 4 ++--
 lib/safe_pthread.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/tst_safe_pthread.h b/include/tst_safe_pthread.h
index cc6da2de8..8fb553929 100644
--- a/include/tst_safe_pthread.h
+++ b/include/tst_safe_pthread.h
@@ -41,8 +41,8 @@ int safe_pthread_barrier_destroy(const char *file, const int lineno,
 	safe_pthread_barrier_destroy(__FILE__, __LINE__, barrier);
 
 int safe_pthread_barrier_init(const char *file, const int lineno,
-			      pthread_barrier_t *restrict barrier,
-			      const pthread_barrierattr_t *restrict attr,
+			      pthread_barrier_t *barrier,
+			      const pthread_barrierattr_t *attr,
 			      unsigned count);
 #define SAFE_PTHREAD_BARRIER_INIT(barrier, attr, count) \
 	safe_pthread_barrier_init(__FILE__, __LINE__, barrier, attr, count);
diff --git a/lib/safe_pthread.c b/lib/safe_pthread.c
index d7bfee4cc..d70bb8707 100644
--- a/lib/safe_pthread.c
+++ b/lib/safe_pthread.c
@@ -90,8 +90,8 @@ int safe_pthread_cancel(const char *file, const int lineno,
 }
 
 int safe_pthread_barrier_init(const char *file, const int lineno,
-			      pthread_barrier_t *restrict barrier,
-			      const pthread_barrierattr_t *restrict attr,
+			      pthread_barrier_t *barrier,
+			      const pthread_barrierattr_t *attr,
 			      unsigned count)
 {
 	int rval;
-- 
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-18 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-18  3:22 [LTP] [PATCH] pthread_barrier_init: remove the restrict limit Li Wang
2022-10-18  8:48 ` Richard Palethorpe
2022-10-18 12:45   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox