Disable spurious -Wstringop-overflow for setjmp/longjmp (bug 26647)
Joseph Myers
joseph@codesourcery.com
Wed Oct 28 23:25:14 GMT 2020
Also, similar errors appear in the testsuite from __sigsetjmp calls in the
installed pthread.h, and presumably would apply in user programs that use
these pthread.h macros. Should we apply a change like this one (with
appropriate version conditionals and comments; as an installed header, it
can't use libc-diag.h) to address such errors both for the glibc testsuite
and for user programs? (With this and the other three patches I've posted
today, both glibc and its testsuite build OK for arm-linux-gnueabi.)
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index d4194da..ec77949 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -658,8 +658,11 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
+ _Pragma ("GCC diagnostic push"); \
+ _Pragma ("GCC diagnostic ignored \"-Wstringop-overflow=\""); \
int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
+ _Pragma ("GCC diagnostic pop"); \
if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
@@ -693,8 +696,11 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
+ _Pragma ("GCC diagnostic push"); \
+ _Pragma ("GCC diagnostic ignored \"-Wstringop-overflow=\""); \
int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
+ _Pragma ("GCC diagnostic pop"); \
if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list