Message ID | 20231022194451.23655-1-marcus.haehnel@kernkonzept.com |
---|---|
State | Accepted |
Headers | show |
Series | [uclibc-ng-devel] setjmp.h: Fix C++ build and avoid duplicate throw declaration | expand |
Hi, patch committed and pushed, thanks Waldemar Marcus Haehnel wrote, > From: Marcus Hähnel <marcus.haehnel@kernkonzept.com> > > Commit 21cbb6fe ("unistd.h: put getppid under XOPEN2K8") introduced a > new __THROWNL specification for non-leaf throws. It also made use of > these in the setjmp.h header. The functions that use this specification > (longjmp and siglongjmp) have their extern __libc__* equivalent > definition prototype specified using __typeof__ for the internal > function signatures. For C++ this copies the throw() specifier, since > this is part of the type for C++. The attribute in C is not. > > This commit explicitly types out the signature for the two functions to > be compatible between the C++ and C worlds. > > An alternative would be to keep the __typeof__ declaration and use > the copy attribute. Then the __THROWNL part could be thrown out since > the C attribute would be copied and the C++ exception specifier would > be part of the signature from __type__. However, since the copy > attribute is not supported for all compilers supported by uclibc-ng > this is not viable at this time. > --- > include/setjmp.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/include/setjmp.h b/include/setjmp.h > index 27cac9500..41337aa9f 100644 > --- a/include/setjmp.h > +++ b/include/setjmp.h > @@ -108,8 +108,10 @@ __END_DECLS > #ifdef _LIBC > extern void __longjmp(__jmp_buf __env, int __val) __THROWNL attribute_noreturn; > libc_hidden_proto(__longjmp) > -extern __typeof(longjmp) __libc_longjmp __THROWNL attribute_noreturn; > -extern __typeof(siglongjmp) __libc_siglongjmp __THROWNL attribute_noreturn; > +extern void __libc_longjmp(struct __jmp_buf_tag __env[1], int __val) > + __THROWNL attribute_noreturn; > +extern void __libc_siglongjmp(sigjmp_buf __env, int __val) > + __THROWNL attribute_noreturn; > extern void _longjmp_unwind(jmp_buf __env, int __val); > libc_hidden_proto(_longjmp_unwind) > extern int __sigjmp_save(sigjmp_buf __env, int __savemask) attribute_hidden; > -- > 2.42.0 > > _______________________________________________ > devel mailing list -- devel@uclibc-ng.org > To unsubscribe send an email to devel-leave@uclibc-ng.org
diff --git a/include/setjmp.h b/include/setjmp.h index 27cac9500..41337aa9f 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -108,8 +108,10 @@ __END_DECLS #ifdef _LIBC extern void __longjmp(__jmp_buf __env, int __val) __THROWNL attribute_noreturn; libc_hidden_proto(__longjmp) -extern __typeof(longjmp) __libc_longjmp __THROWNL attribute_noreturn; -extern __typeof(siglongjmp) __libc_siglongjmp __THROWNL attribute_noreturn; +extern void __libc_longjmp(struct __jmp_buf_tag __env[1], int __val) + __THROWNL attribute_noreturn; +extern void __libc_siglongjmp(sigjmp_buf __env, int __val) + __THROWNL attribute_noreturn; extern void _longjmp_unwind(jmp_buf __env, int __val); libc_hidden_proto(_longjmp_unwind) extern int __sigjmp_save(sigjmp_buf __env, int __savemask) attribute_hidden;
From: Marcus Hähnel <marcus.haehnel@kernkonzept.com> Commit 21cbb6fe ("unistd.h: put getppid under XOPEN2K8") introduced a new __THROWNL specification for non-leaf throws. It also made use of these in the setjmp.h header. The functions that use this specification (longjmp and siglongjmp) have their extern __libc__* equivalent definition prototype specified using __typeof__ for the internal function signatures. For C++ this copies the throw() specifier, since this is part of the type for C++. The attribute in C is not. This commit explicitly types out the signature for the two functions to be compatible between the C++ and C worlds. An alternative would be to keep the __typeof__ declaration and use the copy attribute. Then the __THROWNL part could be thrown out since the C attribute would be copied and the C++ exception specifier would be part of the signature from __type__. However, since the copy attribute is not supported for all compilers supported by uclibc-ng this is not viable at this time. --- include/setjmp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)