Files
RedBear-OS/include/setjmp.h
T
vasilito 5a441d5a1c setjmp.h: declare the POSIX _setjmp/_longjmp
relibc already exports both -- nm libc.a shows 'T _setjmp' and
'T _longjmp' as aliases of setjmp/longjmp -- but setjmp.h never declared
them, so callers got an implicit declaration. GCC 14+ makes that an
error:

    lua-5.4.4/src/ldo.c:66: error: implicit declaration of function
    '_longjmp'; did you mean 'longjmp'?

which broke wireplumber, since it bundles Lua and Lua uses them under
LUA_USE_POSIX.

The difference between the two forms is whether the signal mask is
saved; relibc's implementation saves it in neither, so exporting them as
aliases is accurate rather than a convenience.
2026-08-03 20:25:32 +03:00

48 lines
1.2 KiB
C

#ifndef _SETJMP_H
#define _SETJMP_H
#ifdef __aarch64__
typedef unsigned long long jmp_buf[22];
#endif
#ifdef __i386__
typedef unsigned long long jmp_buf[6];
#endif
#ifdef __x86_64__
typedef unsigned long long jmp_buf[16];
#endif
#ifdef __riscv
typedef unsigned long long jmp_buf[26];
#endif
typedef jmp_buf sigjmp_buf;
#ifdef __cplusplus
extern "C" {
#endif
int setjmp(jmp_buf buf);
void longjmp(jmp_buf buf, int value);
int sigsetjmp(jmp_buf buf, int savemask);
int siglongjmp(jmp_buf buf, int savemask);
/* POSIX _setjmp/_longjmp. relibc already EXPORTS both -- `nm libc.a` shows
`T _setjmp` and `T _longjmp` as aliases of setjmp/longjmp -- they were
simply never declared here, so callers got an implicit declaration, which
GCC 14+ makes an error:
lua-5.4.4/src/ldo.c:66: error: implicit declaration of function
'_longjmp'; did you mean 'longjmp'?
(wireplumber bundles Lua, which uses them under LUA_USE_POSIX.)
The distinction from setjmp/longjmp is the signal mask, which relibc's
implementation does not save in either form, so the alias is accurate. */
int _setjmp(jmp_buf buf);
void _longjmp(jmp_buf buf, int value);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* _SETJMP_H */