diff options
-rw-r--r-- | FICS/assert_error.c | 12 | ||||
-rw-r--r-- | FICS/assert_error.h | 10 | ||||
-rw-r--r-- | FICS/build.mk | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/FICS/assert_error.c b/FICS/assert_error.c new file mode 100644 index 0000000..2d26491 --- /dev/null +++ b/FICS/assert_error.c @@ -0,0 +1,12 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "assert_error.h" + +__dead void +_assert_error(const char *file, const long int line) +{ + (void) fprintf(stderr, "Assertion failed: file %s, line %ld.\n", + file, line); + abort(); +} diff --git a/FICS/assert_error.h b/FICS/assert_error.h new file mode 100644 index 0000000..2de6438 --- /dev/null +++ b/FICS/assert_error.h @@ -0,0 +1,10 @@ +#ifndef ASSERT_ERROR_H +#define ASSERT_ERROR_H + +#ifndef __dead +#define __dead __attribute__((__noreturn__)) +#endif + +__dead void _assert_error(const char *, const long int); + +#endif diff --git a/FICS/build.mk b/FICS/build.mk index b87d430..321cb87 100644 --- a/FICS/build.mk +++ b/FICS/build.mk @@ -5,6 +5,7 @@ SRC_DIR := FICS/ OBJS = $(SRC_DIR)adminproc.o\ $(SRC_DIR)algcheck.o\ + $(SRC_DIR)assert_error.o\ $(SRC_DIR)board.o\ $(SRC_DIR)command.o\ $(SRC_DIR)comproc.o\ |