Skip to content

Commit

Permalink
Minor: fix msvc warning "not all control paths return a value"
Browse files Browse the repository at this point in the history
Moved __has_cpp_attribute block up to first choice. When we have a portable standard way of expressing it, that's the best choice.
(Addresses Review Feedback from Firewave)
  • Loading branch information
StefanVK committed Nov 12, 2023
1 parent 9d2d226 commit 7bcdf4a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@
#endif

// C++11 noreturn
#if (defined(__GNUC__) && (__GNUC__ >= 5)) \
|| defined(__clang__) \
|| defined(__CPPCHECK__)
# define NORETURN [[noreturn]]
#elif defined(__GNUC__)
# define NORETURN __attribute__((noreturn))
#elif defined __has_cpp_attribute
#if defined __has_cpp_attribute
# if __has_cpp_attribute (noreturn)
# define NORETURN [[noreturn]]
# endif
#endif
#if !defined(NORETURN)
# define NORETURN
# if (defined(__GNUC__) && (__GNUC__ >= 5)) \
|| defined(__clang__) \
|| defined(__CPPCHECK__)
# define NORETURN [[noreturn]]
# elif defined(__GNUC__)
# define NORETURN __attribute__((noreturn))
# else
# define NORETURN
# endif
#endif

// fallthrough
Expand Down

0 comments on commit 7bcdf4a

Please sign in to comment.