summaryrefslogtreecommitdiff
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-common.h24
-rw-r--r--source/core/slang-signal.cpp2
-rw-r--r--source/core/slang-signal.h2
3 files changed, 26 insertions, 2 deletions
diff --git a/source/core/slang-common.h b/source/core/slang-common.h
index 362a509a7..907bf4593 100644
--- a/source/core/slang-common.h
+++ b/source/core/slang-common.h
@@ -158,6 +158,30 @@ public:
#define UNREACHABLE_RETURN(x) return x;
#endif
+#if SLANG_GCC
+# define SLANG_EXHAUSTIVE_SWITCH_BEGIN \
+ _Pragma("GCC diagnostic push"); \
+ _Pragma("GCC diagnostic error \"-Wswitch-enum\"");
+# define SLANG_EXHAUSTIVE_SWITCH_END \
+ _Pragma("GCC diagnostic pop");
+#elif SLANG_CLANG
+# define SLANG_EXHAUSTIVE_SWITCH_BEGIN \
+ _Pragma("clang diagnostic push"); \
+ _Pragma("clang diagnostic error \"-Wswitch-enum\"");
+# define SLANG_EXHAUSTIVE_SWITCH_END \
+ _Pragma("clang diagnostic pop");
+#elif SLANG_VC
+# define SLANG_EXHAUSTIVE_SWITCH_BEGIN \
+ _Pragma("warning(push)"); \
+ _Pragma("warning(error : 4062)");
+# define SLANG_EXHAUSTIVE_SWITCH_END \
+ _Pragma("warning(pop)");
+#else
+# define SLANG_EXHAUSTIVE_SWITCH_BEGIN
+# define SLANG_EXHAUSTIVE_SWITCH_END
+#endif
+
+
//
// Use `SLANG_ASSUME(myBoolExpression);` to inform the compiler that the condition is true.
// Do not rely on side effects of the condition being performed.
diff --git a/source/core/slang-signal.cpp b/source/core/slang-signal.cpp
index d8218b379..5f53cba93 100644
--- a/source/core/slang-signal.cpp
+++ b/source/core/slang-signal.cpp
@@ -36,7 +36,7 @@ String _getMessage(SignalType type, char const* message)
// One point of having as a single function is a choke point both for handling (allowing different
// handling scenarios) as well as a choke point to set a breakpoint to catch 'signal' types
-SLANG_RETURN_NEVER void handleSignal(SignalType type, char const* message)
+[[noreturn]] void handleSignal(SignalType type, char const* message)
{
StringBuilder buf;
const char*const typeText = _getSignalTypeAsText(type);
diff --git a/source/core/slang-signal.h b/source/core/slang-signal.h
index 2151bdcfe..759581ee2 100644
--- a/source/core/slang-signal.h
+++ b/source/core/slang-signal.h
@@ -18,7 +18,7 @@ enum class SignalType
// Note that message can be passed as nullptr for no message.
-SLANG_RETURN_NEVER void handleSignal(SignalType type, char const* message);
+[[noreturn]] void handleSignal(SignalType type, char const* message);
#define SLANG_UNEXPECTED(reason) \
::Slang::handleSignal(::Slang::SignalType::Unexpected, reason)