diff options
author | Peter Wu <peter@lekensteyn.nl> | 2016-04-05 22:49:05 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2016-04-08 17:34:10 +0000 |
commit | 57b2a84f3d900eb0b98157095c6aac07cec54fd9 (patch) | |
tree | ec069513b90f83bbb31843a17204ffb0fb97fa69 /epan/except.c | |
parent | 434bbd67a06803ce6bb9a8e0adc6d596246bc458 (diff) |
Use a single WS_NORETURN macro
Having to define two macros for marking a function as never returning
seems a bit redundant. Merge the MSVC and GCC-like attributes into a
single WS_NORETURN.
Tested with Clang 3.7.1, GCC 4.4.7 and even GCC 4.1.2 using this small
program (-Wall -Wextra, the first two generate warnings for
uninitialized variables, the last one compiles without warnings):
#include <stdlib.h>
__attribute__((noreturn)) void foo() { exit(1); }
__attribute__((noreturn)) void bar();
void bar() { exit(1); }
int main() {
int j, i;
if (i) { bar(); return j; }
foo();
return j;
}
Change-Id: I7d19c15e61b8f8fa4936864407199c4109f8cc82
Reviewed-on: https://code.wireshark.org/review/14822
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/except.c')
-rw-r--r-- | epan/except.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/except.c b/epan/except.c index de6021c362..881796ebd8 100644 --- a/epan/except.c +++ b/epan/except.c @@ -180,7 +180,7 @@ static int match(const volatile except_id_t *thrown, const except_id_t *caught) return group_match && code_match; } -G_GNUC_NORETURN WS_MSVC_NORETURN static void do_throw(except_t *except) +WS_NORETURN static void do_throw(except_t *except) { struct except_stacknode *top; @@ -261,7 +261,7 @@ struct except_stacknode *except_pop(void) return top; } -G_GNUC_NORETURN WS_MSVC_NORETURN void except_rethrow(except_t *except) +WS_NORETURN void except_rethrow(except_t *except) { struct except_stacknode *top = get_top(); assert (top != 0); @@ -271,7 +271,7 @@ G_GNUC_NORETURN WS_MSVC_NORETURN void except_rethrow(except_t *except) do_throw(except); } -G_GNUC_NORETURN WS_MSVC_NORETURN void except_throw(long group, long code, const char *msg) +WS_NORETURN void except_throw(long group, long code, const char *msg) { except_t except; @@ -289,7 +289,7 @@ G_GNUC_NORETURN WS_MSVC_NORETURN void except_throw(long group, long code, const do_throw(&except); } -G_GNUC_NORETURN WS_MSVC_NORETURN void except_throwd(long group, long code, const char *msg, void *data) +WS_NORETURN void except_throwd(long group, long code, const char *msg, void *data) { except_t except; @@ -306,7 +306,7 @@ G_GNUC_NORETURN WS_MSVC_NORETURN void except_throwd(long group, long code, const * XCEPT_BUFFER_SIZE? We could then just use this to generate formatted * messages. */ -G_GNUC_NORETURN WS_MSVC_NORETURN void except_throwf(long group, long code, const char *fmt, ...) +WS_NORETURN void except_throwf(long group, long code, const char *fmt, ...) { char *buf = (char *)except_alloc(XCEPT_BUFFER_SIZE); va_list vl; |