From: Eric S. Raymond Date: Mon, 19 Jun 2017 00:33:36 +0000 (-0400) Subject: Attempt to deconfuse the coverage analyzer. X-Git-Tag: 1.1~239 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=83ff9d0c0edda5c08d9966e75addc8cd806cfe6d;p=open-adventure.git Attempt to deconfuse the coverage analyzer. --- 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 */