summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/c99_compat.h1
-rw-r--r--src/util/macros.h12
2 files changed, 9 insertions, 4 deletions
diff --git a/include/c99_compat.h b/include/c99_compat.h
index cb690c6e2a0..81621a7fabc 100644
--- a/include/c99_compat.h
+++ b/include/c99_compat.h
@@ -164,6 +164,7 @@ test_c99_compat_h(const void * restrict a,
# define HAVE_FUNC_ATTRIBUTE_FORMAT 1
# define HAVE_FUNC_ATTRIBUTE_PACKED 1
# define HAVE_FUNC_ATTRIBUTE_ALIAS 1
+# define HAVE_FUNC_ATTRIBUTE_NORETURN 1
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
/* https://gcc.gnu.org/onlinedocs/gcc-4.3.6/gcc/Other-Builtins.html */
diff --git a/src/util/macros.h b/src/util/macros.h
index d6e37053b15..432d5139301 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -171,10 +171,14 @@ do { \
#define ATTRIBUTE_RETURNS_NONNULL
#endif
-#ifdef HAVE_FUNC_ATTRIBUTE_NORETURN
-#define NORETURN __attribute__((__noreturn__))
-#else
-#define NORETURN
+#ifndef NORETURN
+# ifdef _MSC_VER
+# define NORETURN __declspec(noreturn)
+# elif defined HAVE_FUNC_ATTRIBUTE_NORETURN
+# define NORETURN __attribute__((__noreturn__))
+# else
+# define NORETURN
+# endif
#endif
#ifdef __cplusplus