Merge remote-tracking branch 'origin/topic/vern/gen-CPP-precedence-fix'

* origin/topic/vern/gen-CPP-precedence-fix:
  fix for '?' operator precedence when compiling scripts to C++
This commit is contained in:
Tim Wojtulewicz 2025-09-16 10:52:44 -07:00
commit 00ba3483bb
3 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
8.1.0-dev.540 | 2025-09-16 10:52:44 -0700
* fix for '?' operator precedence when compiling scripts to C++ (Vern Paxson, Corelight)
8.1.0-dev.538 | 2025-09-12 09:24:51 -0700
* for -O gen-standalone-C++, make the presence of uncompilable functions fatal unless -O allow-cond is used (Vern Paxson, Corelight)

View file

@ -1 +1 @@
8.1.0-dev.538
8.1.0-dev.540

View file

@ -260,7 +260,7 @@ string CPPCompile::GenCondExpr(const Expr* e, GenType gt) {
if ( op1->GetType()->Tag() == TYPE_VECTOR )
return string("vector_select__CPP(") + gen1 + ", " + gen2 + ", " + gen3 + ")";
return string("(") + gen1 + ") ? (" + gen2 + ") : (" + gen3 + ")";
return string("((") + gen1 + ") ? (" + gen2 + ") : (" + gen3 + "))";
}
string CPPCompile::GenCallExpr(const CallExpr* c, GenType gt, bool top_level) {