Avril 4 years ago
parent d8cbe4b59d
commit 6fcf9f58f1
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -0,0 +1,30 @@
#ifndef _SHUFFLE3_H
#define _SHUFFLE3_H
#ifdef __cplusplus
#define _UNIQUE __restrict
extern "C" {
#else
#define _UNIQUE restrict
#endif
#ifdef DEBUG
#define _FORCE_INLINE __attribute__((gnu_inline)) static inline
#else
#define _FORCE_INLINE __attribute__((gnu_inline)) extern inline
#endif
struct panicinfo {
const char* file;
const char* function;
int line;
};
void _do_panic(struct panicinfo pi, const char* fmt, ...) __attribute__((noreturn, cold));
#define panic(fmt, ...) _do_panic( (struct panicinfo){.file = __FILE__, .function = __func__, .line = __LINE__}, fmt __VA_OPT__(,) __VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif /* _SHUFFLE3_H */

@ -0,0 +1,17 @@
#include <shuffle3.h>
static void shuffle_file(const char* filename)
{
panic("unimplemented");
}
static void unshuffle_file(const char* filename)
{
panic("unimplemented");
}
int main(int argc, char** argv)
{
return 0;
}

@ -0,0 +1,16 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <shuffle3.h>
__attribute__((noreturn, cold)) void _do_panic(struct panicinfo info, const char* fmt, ...)
{
va_list li;
va_start(li, fmt);
fprintf(stderr, "[!] (%s->%s:%d) fatal error: ", info.file, info.function, info.line);
vfprintf(stderr, fmt, li);
fprintf(stderr, "\n");
va_end(li);
abort();
}
Loading…
Cancel
Save