pthread_barrier_init: remove the restrict limit
PATCH 1/1 pthread_barrier_init: remove the restrict limit
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
---
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(-)
include/tst_safe_pthread.h +2 -2
@@ -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);
lib/safe_pthread.c +2 -2
@@ -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;
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hello,
Quoted 10 lines · Li Wang
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 <[email protected]>
Sure, we don't care about this optimization. If it were a safety feature I would suggest adding macros with an empty fallback.
Quoted 6 lines
---
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.
It would be nice to at least use C99, but I guess we can wait a bit longer until centos7 is EOL.
Quoted 35 lines
include/tst_safe_pthread.h | 4 ++-- lib/safe_pthread.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)include/tst_safe_pthread.h +2
-2@@ -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);lib/safe_pthread.c +2
-2@@ -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;
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel
Acked-byHi,
Quoted 12 lines
Hello,
Quoted 8 lines · Li Wang
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
...
Quoted 7 lines
Quoted 4 lines
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.It would be nice to at least use C99, but I guess we can wait a bit longer until centos7 is EOL.
Exactly.
Also LTP is used by others on embedded, which might still have old toolchain (although C99 as the default is since gcc 5.x [1], I'm not sure if anybody really uses gcc 4.9.x [2], we could ask on automated-testing ML after 2024-06 - CentOS 7 EOL).
Kind regards,
Petr
[1] https://gcc.gnu.org/onlinedocs/gcc-5.5.0/gcc/Standards.html
[2] https://gcc.gnu.org/onlinedocs/gcc-4.9.4/gcc/Standards.html
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp