summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1be224b)
raw | patch | inline | side by side (parent: 1be224b)
author | Erik Faye-Lund <kusmabite@googlemail.com> | |
Wed, 30 Sep 2009 18:05:49 +0000 (18:05 +0000) | ||
committer | Jeff King <peff@peff.net> | |
Thu, 1 Oct 2009 08:12:21 +0000 (04:12 -0400) |
Some compilers (including at least MSVC) support NORETURN
on function declarations, but only before the function-name.
This patch makes it possible to define NORETURN to something
meaningful for those compilers.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
on function declarations, but only before the function-name.
This patch makes it possible to define NORETURN to something
meaningful for those compilers.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
git-compat-util.h | patch | blob | history | |
index-pack.c | patch | blob | history | |
usage.c | patch | blob | history |
diff --git a/git-compat-util.h b/git-compat-util.h
index 8d6e29cdeadfe146f4542c0b2b8ba803dedd2293..bac376f4c7bc93efbc8e3c32c05ae503f3c14534 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
#include "compat/bswap.h"
/* General helper functions */
-extern void usage(const char *err) NORETURN;
-extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
-extern void die_errno(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
+extern NORETURN void usage(const char *err);
+extern NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2)));
+extern NORETURN void die_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)));
-extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
+extern void set_die_routine(NORETURN void (*routine)(const char *err, va_list params));
extern int prefixcmp(const char *str, const char *prefix);
extern time_t tm_to_time_t(const struct tm *tm);
diff --git a/index-pack.c b/index-pack.c
index 340074fc793e8e7534bb168784a7051af6d81b34..b4f82786592e2e34392191e823d645e17d955fcf 100644 (file)
--- a/index-pack.c
+++ b/index-pack.c
use(sizeof(struct pack_header));
}
-static void bad_object(unsigned long offset, const char *format,
- ...) NORETURN __attribute__((format (printf, 2, 3)));
+static NORETURN void bad_object(unsigned long offset, const char *format,
+ ...) __attribute__((format (printf, 2, 3)));
static void bad_object(unsigned long offset, const char *format, ...)
{
index b6aea45280bf2aa4c06a0130f912a61377165016..0555ce6ccd514f7dbbfafc16fa137790078e32e8 100644 (file)
--- a/usage.c
+++ b/usage.c
/* If we are in a dlopen()ed .so write to a global variable would segfault
* (ugh), so keep things static. */
-static void (*usage_routine)(const char *err) NORETURN = usage_builtin;
-static void (*die_routine)(const char *err, va_list params) NORETURN = die_builtin;
+static NORETURN void (*usage_routine)(const char *err) = usage_builtin;
+static NORETURN void (*die_routine)(const char *err, va_list params) = die_builtin;
static void (*error_routine)(const char *err, va_list params) = error_builtin;
static void (*warn_routine)(const char *err, va_list params) = warn_builtin;
-void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN)
+void set_die_routine(NORETURN void (*routine)(const char *err, va_list params))
{
die_routine = routine;
}