diff options
author | Roland Scheidegger <[email protected]> | 2018-01-11 01:49:00 +0100 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2018-01-12 02:52:10 +0100 |
commit | 85377dc55c55d1c5536cdf9a86ce67ebb59b7e77 (patch) | |
tree | 99c1c36e45c497e58b573fa4cc437b4b2ba768ed /src/util/macros.h | |
parent | ad11fc3571e025b22d9feed80a7f499665f7a255 (diff) |
util: fix NORETURN for msvc, add HAVE_FUNC_ATTRIBUTE_NORETURN to c99_compat.h
We've seen some problems internally due to macro redefinition.
Fix this by adding HAVE_FUNC_ATTRIBUTE_NORETURN to c99_compat.h,
and defining it for msvc.
And avoid redefinition just in case.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/util/macros.h')
-rw-r--r-- | src/util/macros.h | 12 |
1 files changed, 8 insertions, 4 deletions
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 |