Add setjmp.h header

This commit is contained in:
avdgrinten 2015-12-02 13:23:42 +01:00
parent 10221677e2
commit b971bfb173
3 changed files with 39 additions and 2 deletions

View file

@ -3,10 +3,11 @@ $c_SRCDIR = $(TREE_PATH)/$c/src
$c_HEADERDIR := $(TREE_PATH)/$c/include
$c_OBJDIR := $(BUILD_PATH)/$c/obj
$c_HEADERS := assert.h ctype.h errno.h locale.h math.h signal.h stdio.h stdlib.h string.h time.h \
$c_HEADERS := assert.h ctype.h errno.h locale.h math.h setjmp.h signal.h stdio.h stdlib.h \
string.h time.h \
mlibc/ensure.h
$c_OBJECTS := assert.o ctype.o locale.o math.o signal.o stdio.o stdlib.o string.o time.o
$c_OBJECTS := assert.o ctype.o locale.o math.o setjmp.o signal.o stdio.o stdlib.o string.o time.o
$c_OBJECT_PATHS := $(addprefix $($c_OBJDIR)/,$($c_OBJECTS))
$c_CXX := x86_64-managarm-g++

View file

@ -0,0 +1,21 @@
#ifndef _SETJMP_H
#define _SETJMP_H
#ifdef __cplusplus
extern "C" {
#endif
// [C11/7.13] Non-local jumps
typedef int jmp_buf[0];
__attribute__ (( returns_twice )) int setjmp(jmp_buf buffer);
__attribute__ (( noreturn )) void longjmp(jmp_buf buffer, int value);
#ifdef __cplusplus
}
#endif
#endif // _SETJMP_H

View file

@ -0,0 +1,15 @@
#include <setjmp.h>
#include <mlibc/ensure.h>
int setjmp(jmp_buf buffer) {
__ensure(!"Not implemented");
__builtin_unreachable();
}
void longjmp(jmp_buf buffer, int value) {
__ensure(!"Not implemented");
__builtin_unreachable();
}