From 97bb82ebcdf8f1391b9d93b5a8d7b1dfc4e88e52 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 4 Oct 2021 14:15:51 -0400 Subject: 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. --- slang.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'slang.h') 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 -- cgit v1.2.3