From ed0f3b1b8593f6b76fbb64c53a0885073c1c1979 Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Fri, 19 Dec 2025 11:12:20 -0800 Subject: Fix many of the warnings that show up when compiling with GCC 15.2 --- lang/c/pseudoc.cpp | 62 +++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'lang/c/pseudoc.cpp') diff --git a/lang/c/pseudoc.cpp b/lang/c/pseudoc.cpp index 48763804..5a67eb40 100644 --- a/lang/c/pseudoc.cpp +++ b/lang/c/pseudoc.cpp @@ -430,27 +430,27 @@ PseudoCFunction::FieldDisplayType PseudoCFunction::GetFieldDisplayType( std::optional PseudoCFunction::CanSimplifyToTernary(const BinaryNinja::HighLevelILInstruction &instr) const { - // Only handle if-statements - if (instr.operation != HLIL_IF) - return std::nullopt; + // Only handle if-statements + if (instr.operation != HLIL_IF) + return std::nullopt; - auto conditionExpr = instr.GetConditionExpr(); - auto trueExpr = instr.GetTrueExpr(); - auto falseExpr = instr.GetFalseExpr(); + auto conditionExpr = instr.GetConditionExpr(); + auto trueExpr = instr.GetTrueExpr(); + auto falseExpr = instr.GetFalseExpr(); if (GetHighLevelILFunction()->HasSideEffects(conditionExpr)) return std::nullopt; - // Both branches must be assignment operations - if (trueExpr.operation != HLIL_ASSIGN || falseExpr.operation != HLIL_ASSIGN) - return std::nullopt; + // Both branches must be assignment operations + if (trueExpr.operation != HLIL_ASSIGN || falseExpr.operation != HLIL_ASSIGN) + return std::nullopt; - // Get the destination expressions of the assignments - auto trueDestExpr = trueExpr.GetDestExpr(); - auto falseDestExpr = falseExpr.GetDestExpr(); + // Get the destination expressions of the assignments + auto trueDestExpr = trueExpr.GetDestExpr(); + auto falseDestExpr = falseExpr.GetDestExpr(); - // Verify that the destination expressions are variable references - if (trueDestExpr.operation != HLIL_VAR || falseDestExpr.operation != HLIL_VAR) - return std::nullopt; + // Verify that the destination expressions are variable references + if (trueDestExpr.operation != HLIL_VAR || falseDestExpr.operation != HLIL_VAR) + return std::nullopt; auto trueExprDestExpr = trueExpr.GetDestExpr(); auto falseExprDestExpr = falseExpr.GetDestExpr(); @@ -467,22 +467,22 @@ std::optional PseudoCFunction::CanSimplifyToTernar if (GetHighLevelILFunction()->HasSideEffects(trueExprSourceExpr) || GetHighLevelILFunction()->HasSideEffects(falseExprSourceExpr)) return std::nullopt; - // Avoid folding for "else if" cases - for (auto parent = instr; parent.HasParent(); parent = parent.GetParent()) - { - if (parent.operation != HLIL_IF) - break; - auto parentFalse = parent.GetFalseExpr(); - if (parentFalse.operation == HLIL_IF) - return std::nullopt; - } - - TernaryInfo info; - info.conditional = conditionExpr; - info.assignDest = trueDestExpr; - info.trueAssign = trueExprSourceExpr; - info.falseAssign = falseExprSourceExpr; - return info; + // Avoid folding for "else if" cases + for (auto parent = instr; parent.HasParent(); parent = parent.GetParent()) + { + if (parent.operation != HLIL_IF) + break; + auto parentFalse = parent.GetFalseExpr(); + if (parentFalse.operation == HLIL_IF) + return std::nullopt; + } + + TernaryInfo info; + info.conditional = conditionExpr; + info.assignDest = trueDestExpr; + info.trueAssign = trueExprSourceExpr; + info.falseAssign = falseExprSourceExpr; + return info; } bool PseudoCFunction::TryEmitSimplifiedTernary( -- cgit v1.3.1