From 492f56e02fe9e9902eabefaa34f5b2fc9778dd47 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:47:10 -0700 Subject: Add option -disable-short-circuit (#4054) Add option -disable-short-circuit to disable short circuit for logic operators && and ||. Also, disable the short circuit by default in the stdlib. --- source/slang/slang-options.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/slang/slang-options.cpp') diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index dad69350e..7337b9210 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -343,6 +343,7 @@ void initCommandOptions(CommandOptions& options) "The name used as the basis for variables output for source embedding."}, { OptionKind::SourceEmbedLanguage, "-source-embed-language", "-source-embed-language ", "The language to be used for source embedding. Defaults to C/C++. Currently only C/C++ are supported"}, + { OptionKind::DisableShortCircuit, "-disable-short-circuit", nullptr, "Disable short-circuiting for \"&&\" and \"||\" operations" }, }; _addOptions(makeConstArrayView(generalOpts), options); @@ -2298,6 +2299,11 @@ SlangResult OptionsParser::_parse( break; } + case OptionKind::DisableShortCircuit: + { + linkage->m_optionSet.add(OptionKind::DisableShortCircuit, true); + break; + } default: { // Hmmm, we looked up and produced a valid enum, but it wasn't handled in the switch... -- cgit v1.2.3