Skip to content

Commit

Permalink
Expand NORETURN, enable C99 unconditionally on MSVC
Browse files Browse the repository at this point in the history
[[noreturn]] is supported on all the compilers we support. Still need to decide
the exact minimum versions and figure out what to do with DEPRECATED and FALLTHROUGH,
so leaving those for now.

And since we require VS 2015 and up we can enable C99 unconditionally.
  • Loading branch information
Vultraz committed Apr 14, 2018
1 parent 00d87f8 commit 9668115
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/gettext_boost.cpp
Expand Up @@ -142,7 +142,7 @@ namespace
}
}

NORETURN static void throw_po_error(const std::string& lang, const std::string& dom, const std::string& detail) {
[[noreturn]] static void throw_po_error(const std::string& lang, const std::string& dom, const std::string& detail) {
std::ostringstream err;
err << "Error opening language file for " << lang << ", textdomain " << dom
<< ":\n " << detail << '\n';
Expand Down
13 changes: 1 addition & 12 deletions src/global.hpp
Expand Up @@ -16,10 +16,8 @@

#ifdef _MSC_VER

// Enable C99 support for VC14
#if _MSC_VER>=1900
// Enable C99 support
#define STDC99
#endif

#endif //_MSC_VER

Expand All @@ -42,12 +40,6 @@

// Some C++11 features are not available on all supported platforms
#if defined(_MSC_VER)
// MSVC supports these starting in MSVC 2015
#if _MSC_VER >= 1900
#define NORETURN [[noreturn]]
#else
#define NORETURN __declspec(noreturn)
#endif
// MSVC supports these starting in 2017?
// Some sources claim MSVC 2015 supports them, but let's be safe...
#if _MSC_VER >= 1910
Expand All @@ -67,16 +59,13 @@
#include <ciso646> // To ensure standard library version macros are defined

// All supported versions of clang have these
#define NORETURN [[noreturn]]
#define FALLTHROUGH [[clang::fallthrough]]
// Use GCC-style attribute because the __has_cpp_attribute feature-checking macro doesn't exist in clang 3.5
#define DEPRECATED(reason) __attribute__((deprecated(reason)))

#endif

#if defined(__GNUC__) && !defined(__clang__)
// GCC supports these from 4.8 up
#define NORETURN [[noreturn]]

// Deprecated is supported from 4.9 up
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
Expand Down
2 changes: 1 addition & 1 deletion src/wml_exception.hpp
Expand Up @@ -80,7 +80,7 @@
* @param function The function in which the test failed.
* @param message The translated message to show the user.
*/
NORETURN void throw_wml_exception(
[[noreturn]] void throw_wml_exception(
const char* cond
, const char* file
, int line
Expand Down

0 comments on commit 9668115

Please sign in to comment.