summaryrefslogtreecommitdiffstats
path: root/slang.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-10-04 14:15:51 -0400
committerGitHub <noreply@github.com>2021-10-04 14:15:51 -0400
commit97bb82ebcdf8f1391b9d93b5a8d7b1dfc4e88e52 (patch)
treef120ba282cbea96d23ed179737984a4610d3b520 /slang.h
parentb3dfe383c6d31ff3dbd76dcfb32de8d536382f3e (diff)
Removing exceptions from core/compiler-core (#1953)
* #include an absolute path didn't work - because paths were taken to always be relative. * Refactor Stream. Working on all tests. * Split out CharEncode. * Make method names lower camel. m_prefix in Writer/Reader * Tidy up around CharEncode interface. * Small improvements around encode/decode. * Better use of types. * Remove readLine from TextReader. * Remove exceptions from Stream/Text handling. * Fix some typos. * Fix tabbing. * Fix missing override. * Remove remaining exception throw/catch via using signal mechanism. * Remove exceptions that are not used anymore. * Document the Stream interface. * Remove index for decoding 'get byte' function. * Fix CharReader -> ByteReader.
Diffstat (limited to 'slang.h')
-rw-r--r--slang.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/slang.h b/slang.h
index c726fc23c..00e22e676 100644
--- a/slang.h
+++ b/slang.h
@@ -276,6 +276,16 @@ convention for interface methods.
/// SLANG_INLINE exists to have a way to inline consistent with SLANG_ALWAYS_INLINE
#define SLANG_INLINE inline
+// If explicilty disabled and not set, set to not available
+#if !defined(SLANG_HAS_EXCEPTIONS) && defined(SLANG_DISABLE_EXCEPTIONS)
+# define SLANG_HAS_EXCEPTIONS 0
+#endif
+
+// If not set, the default is exceptions are available
+#ifndef SLANG_HAS_EXCEPTIONS
+# define SLANG_HAS_EXCEPTIONS 1
+#endif
+
// Other defines
#define SLANG_STRINGIZE_HELPER(X) #X
#define SLANG_STRINGIZE(X) SLANG_STRINGIZE_HELPER(X)
@@ -311,6 +321,7 @@ convention for interface methods.
# define SLANG_HAS_ENUM_CLASS 1
# define SLANG_OVERRIDE override
# endif
+
// Gcc
#elif SLANG_GCC_FAMILY
// Check for C++11
@@ -325,6 +336,12 @@ convention for interface methods.
# define SLANG_OVERRIDE override
# endif
# endif
+
+// TODO(JS): Not used in previous code. Left here as may be useful on some other version.
+// #define SLANG_RETURN_NEVER __attribute__((__noreturn__))
+
+# define SLANG_RETURN_NEVER [[noreturn]]
+
# endif // SLANG_GCC_FAMILY
// Visual Studio
@@ -342,6 +359,8 @@ convention for interface methods.
# define SLANG_HAS_ENUM_CLASS 1
# endif
+# define SLANG_RETURN_NEVER __declspec(noreturn)
+
# endif // SLANG_VC
// Set non set
@@ -357,6 +376,10 @@ convention for interface methods.
#endif // __cplusplus
+#ifndef SLANG_RETURN_NEVER
+# define SLANG_RETURN_NEVER /* empty */
+#endif // SLANG_RETURN_NEVER
+
/* Macros for detecting processor */
#if defined(_M_ARM) || defined(__ARM_EABI__)
// This is special case for nVidia tegra