mirror of
https://github.com/tailix/libclayer.git
synced 2024-10-30 11:54:08 -04:00
Remove runtime
This commit is contained in:
parent
78fbb3e7ec
commit
d5330b1744
10 changed files with 3 additions and 76 deletions
|
@ -35,7 +35,7 @@ endif
|
|||
|
||||
libkernaux_la_LDFLAGS = -version-info @PACKAGE_VERSION_SO@
|
||||
libkernaux_la_LIBADD =
|
||||
libkernaux_la_SOURCES = src/runtime.c
|
||||
libkernaux_la_SOURCES = src/xxxxx.c
|
||||
|
||||
########
|
||||
# libc #
|
||||
|
|
14
README.md
14
README.md
|
@ -39,7 +39,6 @@ may only change when major version number is increased (or minor while major is
|
|||
zero). Work-in-progress APIs can change at any time.
|
||||
|
||||
* Basic features
|
||||
* [Runtime environment](/include/kernaux/runtime.h) (*non-breaking since* **0.7.0**)
|
||||
* [Macros](/include/kernaux/macro.h) (*non-breaking since* **0.6.0**)
|
||||
* Stack trace *(planned)*
|
||||
* libc replacement (*work in progress*)
|
||||
|
@ -62,19 +61,6 @@ zero). Work-in-progress APIs can change at any time.
|
|||
* `KERNAUX_BITFIELDS` - enable bitfields in packed structs. It doesn't follow
|
||||
the C standard and may be incompatible with some compilers.
|
||||
|
||||
### Global variables
|
||||
|
||||
```c
|
||||
// in <kernaux/runtime.h>
|
||||
void (*kernaux_assert_cb)(const char *file, int line, const char *msg)
|
||||
```
|
||||
|
||||
Assertion callback. It's better to always set it to some function which always
|
||||
interrupts the execution, even when assertions are disabled. It may for example
|
||||
call `abort()` in hosted environment, raise an exception in Ruby, panic in Rust
|
||||
or power off the machine in freestanding environment. It may also log the error
|
||||
location and message.
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ AC_CANONICAL_HOST
|
|||
|
||||
AC_CONFIG_MACRO_DIRS([m4])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([src/runtime.c])
|
||||
AC_CONFIG_SRCDIR([src/xxxxx.c])
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
libkernaux.pc
|
||||
|
|
|
@ -2,5 +2,4 @@ nobase_include_HEADERS = \
|
|||
kernaux.h \
|
||||
kernaux/macro.h \
|
||||
kernaux/macro/packing_end.run \
|
||||
kernaux/macro/packing_start.run \
|
||||
kernaux/runtime.h
|
||||
kernaux/macro/packing_start.run
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
#include <kernaux/macro.h>
|
||||
#include <kernaux/runtime.h>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef KERNAUX_INCLUDED_RUNTIME
|
||||
#define KERNAUX_INCLUDED_RUNTIME
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*KernAux_Assert_Cb)(const char *file, int line, const char *msg);
|
||||
|
||||
extern KernAux_Assert_Cb kernaux_assert_cb;
|
||||
|
||||
void kernaux_assert_do(const char *file, int line, const char *msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -2,7 +2,6 @@ include/kernaux.h
|
|||
include/kernaux/macro.h
|
||||
include/kernaux/macro/packing_end.run
|
||||
include/kernaux/macro/packing_start.run
|
||||
include/kernaux/runtime.h
|
||||
lib/libkernaux.a
|
||||
lib/libkernaux.so
|
||||
lib/libkernaux.so.0
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
#ifndef KERNAUX_INCLUDED_ASSERT
|
||||
#define KERNAUX_INCLUDED_ASSERT
|
||||
|
||||
#include <kernaux/runtime.h>
|
||||
|
||||
#ifdef ENABLE_ASSERT
|
||||
#define KERNAUX_PANIC(msg) (kernaux_assert_do(__FILE__, __LINE__, msg))
|
||||
#define KERNAUX_ASSERT(cond) ((cond) ? (void)0 : KERNAUX_PANIC(#cond))
|
||||
#else
|
||||
#define KERNAUX_PANIC(msg) ((void)0)
|
||||
#define KERNAUX_ASSERT(cond) ((void)0)
|
||||
#endif
|
||||
|
||||
#define KERNAUX_NOTNULL(cond) KERNAUX_ASSERT(cond)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/runtime.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
KernAux_Assert_Cb kernaux_assert_cb = NULL;
|
||||
|
||||
void kernaux_assert_do(
|
||||
const char *const file,
|
||||
const int line,
|
||||
const char *const msg
|
||||
) {
|
||||
if (kernaux_assert_cb) kernaux_assert_cb(file, line, msg);
|
||||
}
|
13
tests/main.c
13
tests/main.c
|
@ -2,25 +2,12 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/runtime.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void test_main(int argc, char **argv);
|
||||
|
||||
static void assert_cb(
|
||||
const char *const file,
|
||||
const int line,
|
||||
const char *const msg
|
||||
) {
|
||||
fprintf(stderr, "%s:%d:%s\n", file, line, msg);
|
||||
abort();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
kernaux_assert_cb = assert_cb;
|
||||
test_main(argc, argv);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue