From 97631e9a8aae44315a96d57fa8bca75b3799f9cb Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Wed, 24 Apr 2024 07:18:21 -0700 Subject: Avoid DXC warnings for missing bitwise op parantheses (#4004) Resolves #3980 Based on the operator precedence, Slang may omits the parentheses if they are not needed. DXC prints warnings for such cases and some applications may treat the warnings as errors. This commit emits parentheses to avoid the DXC warning even when they are not needed. --- source/slang/slang-emit-metal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/slang/slang-emit-metal.cpp') diff --git a/source/slang/slang-emit-metal.cpp b/source/slang/slang-emit-metal.cpp index 17d074e75..bf4a67b09 100644 --- a/source/slang/slang-emit-metal.cpp +++ b/source/slang/slang-emit-metal.cpp @@ -283,7 +283,7 @@ bool MetalSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inO needClose = maybeEmitParens(outerPrec, prec); emitOperand(inst->getOperand(0), leftSide(outerPrec, prec)); m_writer->emit("+"); - emitOperand(inst->getOperand(1), rightSide(prec, outerPrec)); + emitOperand(inst->getOperand(1), rightSide(outerPrec, prec)); maybeCloseParens(needClose); return true; } -- cgit v1.2.3