From 0ce905c057c3215d1fc1b1beb1900e206024afad Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 3 Jan 2024 01:10:45 +0100 Subject: Added _assert_error() --- FICS/assert_error.c | 12 ++++++++++++ FICS/assert_error.h | 10 ++++++++++ FICS/build.mk | 1 + 3 files changed, 23 insertions(+) create mode 100644 FICS/assert_error.c create mode 100644 FICS/assert_error.h (limited to 'FICS') 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 +#include + +#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\ -- cgit v1.2.3