From df65b668b750d4f025b37b794e8efef4bd51dd92 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 4 Jan 2024 16:45:13 -0700 Subject: [PATCH] CPP-gen: Don't emit extra braces if only one element --- src/script_opt/CPP/InitsInfo.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/script_opt/CPP/InitsInfo.cc b/src/script_opt/CPP/InitsInfo.cc index 3dc3536edc..c8150dbe96 100644 --- a/src/script_opt/CPP/InitsInfo.cc +++ b/src/script_opt/CPP/InitsInfo.cc @@ -47,9 +47,13 @@ void CPP_InitsInfo::GenerateInitializers(CPPCompile* c) { if ( ++n > 1 ) c->Emit(""); - c->Emit("{"); - BuildCohort(c, cohort); - c->Emit("},"); + if ( cohort.size() == 1 ) + BuildCohort(c, cohort); + else { + c->Emit("{"); + BuildCohort(c, cohort); + c->Emit("},"); + } } c->Emit("}");