From 83ff9d0c0edda5c08d9966e75addc8cd806cfe6d Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 18 Jun 2017 20:33:36 -0400 Subject: [PATCH] Attempt to deconfuse the coverage analyzer. --- common.h | 8 ++------ dungeon.c | 6 ++++++ misc.c | 6 ++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/common.h b/common.h index 59e87ef..0e865c4 100644 --- a/common.h +++ b/common.h @@ -35,12 +35,8 @@ enum bugtype { ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH, // 100 }; -static inline void bug(enum bugtype num, const char *error_string) __attribute__((__noreturn__)); -static inline void bug(enum bugtype num, const char *error_string) -{ - fprintf(stderr, "Fatal error %d, %s.\n", num, error_string); - exit(EXIT_FAILURE); -} +/* Alas, declaring this static confuses the coverage analyzer */ +void bug(enum bugtype, const char *) __attribute__((__noreturn__)); #define BUG(x) bug(x, #x) diff --git a/dungeon.c b/dungeon.c index 544fce8..0d82fb6 100644 --- a/dungeon.c +++ b/dungeon.c @@ -554,6 +554,12 @@ static void write_file(FILE* header_file) fprintf(header_file, "#endif\n"); } +void bug(enum bugtype num, const char *error_string) +{ + fprintf(stderr, "Fatal error %d, %s.\n", num, error_string); + exit(EXIT_FAILURE); +} + int main(void) { FILE* database = fopen("adventure.text", "r"); diff --git a/misc.c b/misc.c index 26bb332..9899b08 100644 --- a/misc.c +++ b/misc.c @@ -658,4 +658,10 @@ void DATIME(long* d, long* t) *t = (long) tv.tv_usec; } +void bug(enum bugtype num, const char *error_string) +{ + fprintf(stderr, "Fatal error %d, %s.\n", num, error_string); + exit(EXIT_FAILURE); +} + /* end */ -- 2.31.1