musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/include/setjmp.h
AgeCommit message (Collapse)AuthorLines
2021年02月22日guard against compilers failing to handle setjmp specially by default Rich Felker-3/+11
since 4.1, gcc has had the __returns_twice__ attribute and has required functions which return twice to carry it; however it's always applied it automatically to known setjmp-like function names. clang however does not do this reliably, at least not with -ffreestanding and possibly under other conditions, resulting in silent emission of wrong code. since the symbol name setjmp is in no way special (setjmp is specified as a macro that could expand to use any implementation-specific symbol name or names), a compiler is justified not to do anything special without further hints, and it's reasonable to do what we can to provide such hints. gcc 4.0.x and earlier do not recognize the attribute, so make use conditional on __GNUC__ macros. clang and other gcc-like compilers report (and have always reported) a later "GNUC" version so the preprocessor conditional should function as desired for them as too. undefine the internal macro after use so that nothing abuses it as a public feature.
2015年04月01日remove macro definition of longjmp from setjmp.h Rich Felker-1/+0
the C standard specifies that setjmp is a macro, but longjmp is a normal function. a macro version of it would be permitted (albeit useless) for C (not C++), but would have to be a function-like macro, not an object-like one.
2013年07月24日change jmp_buf to share an underlying type and struct tag with sigjmp_buf Rich Felker-7/+6
this is necessary to meet the C++ ABI target. alternatives were considered to avoid the size increase for non-sig jmp_buf objects, but they seemed to have worse properties. moreover, the relative size increase is only extreme on x86[_64]; one way of interpreting this is that, if the size increase from this patch makes jmp_buf use too much memory, then the program was already using too much memory when built for non-x86 archs.
2013年01月04日setjmp.h: add struct tag for sigjmp_buf (GCC C++ compatibility) rofl0r-1/+1
the anonymous struct typedef with array notation breaks with GCC in C++ mode: error: non-local function 'static<anonymous struct> (& boost::signal_handler::jump_buffer())[1]' uses anonymous type this is a known GCC issue, as search results for that error msg suggest. since this is hard to work around in the calling C++ code, a fix in musl is preferable.
2012年09月07日default features: make musl usable without feature test macros Rich Felker-6/+1
the old behavior of exposing nothing except plain ISO C can be obtained by defining __STRICT_ANSI__ or using a compiler option (such as -std=c99) that predefines it. the new default featureset is POSIX with XSI plus _BSD_SOURCE. any explicit feature test macros will inhibit the default. installation docs have also been updated to reflect this change.
2012年09月06日further use of _Noreturn, for non-plain-C functions Rich Felker-2/+2
note that POSIX does not specify these functions as _Noreturn, because POSIX is aligned with C99, not the new C11 standard. when POSIX is eventually updated to C11, it will almost surely give these functions the _Noreturn attribute. for now, the actual _Noreturn keyword is not used anyway when compiling with a c99 compiler, which is what POSIX requires; the GCC __attribute__ is used instead if it's available, however. in a few places, I've added infinite for loops at the end of _Noreturn functions to silence compiler warnings. presumably __buildin_unreachable could achieve the same thing, but it would only work on newer GCCs and would not be portable. the loops should have near-zero code size cost anyway. like the previous _Noreturn commit, this one is based on patches contributed by philomath.
2012年09月06日add _Noreturn function attribute, with fallback for pre-C11 GNUC Rich Felker-1/+8
2012年07月22日fix wrong size for sigjmp_buf signal set array Rich Felker-1/+1
128 is the size in bytes, not longs.
2012年07月03日jmp_buf overhaul fixing several issues Rich Felker-1/+5
on arm, the location of the saved-signal-mask flag and mask were off by one between sigsetjmp and siglongjmp, causing incorrect behavior restoring the signal mask. this is because the siglongjmp code assumed an extra slot was in the non-sig jmp_buf for the flag, but arm did not have this. now, the extra slot is removed for all archs since it was useless. also, arm eabi requires jmp_buf to have 8-byte alignment. we achieve that using long long as the type rather than with non-portable gcc attribute tags.
2012年05月23日debloat jmp_buf in _GNU_SOURCE mode Rich Felker-3/+0
i originally made it the same size as the bloated GNU version, which contains space for saved signal mask, but this makes some structures containing jmp_buf become much larger for no benefit. we will never use the signal mask field with plain setjmp; sigsetjmp serves that purpose.
2012年05月22日support _BSD_SOURCE feature test macro Rich Felker-2/+4
patch by Isaac Dunham. matched closely (maybe not exact) to glibc's idea of what _BSD_SOURCE should make visible.
2011年02月14日major bugfix for sigset_t (it was mistakenly 1024 bytes instead of bits) Rich Felker-1/+1
note that object files using sigset_t (or struct sigaction) need to be recompiled to work correctly after this fix.
2011年02月14日extensive header cleanup for standards conformance & correctness Rich Felker-5/+13
thanks to Peter Mazinger (psm) for pointing many of these issues out and submitting a patch on which this commit is loosely based
2011年02月12日initial check-in, version 0.5.0 v0.5.0 Rich Felker-0/+30
generated by cgit v1.2.1 (git 2.18.0) at 2025年11月04日 01:50:30 +0000

AltStyle によって変換されたページ (->オリジナル) /