diff --git a/CHANGES b/CHANGES index 3e36bbdf99..c585334ded 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +8.1.0-dev.544 | 2025-09-16 11:02:35 -0700 + + * fix for associating attributes with globals for -O gen-standalone-C++ (Vern Paxson, Corelight) + 8.1.0-dev.542 | 2025-09-16 10:53:04 -0700 * fix for tracking identifiers and aggregates when compiling to standalone-C++ (Vern Paxson, Corelight) diff --git a/VERSION b/VERSION index a658c02256..f1dd204f23 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.1.0-dev.542 +8.1.0-dev.544 diff --git a/src/script_opt/CPP/Inits.cc b/src/script_opt/CPP/Inits.cc index a73b96a379..b286ef14de 100644 --- a/src/script_opt/CPP/Inits.cc +++ b/src/script_opt/CPP/Inits.cc @@ -225,10 +225,9 @@ void CPPCompile::InitializeGlobals() { const auto& attrs = g->GetAttrs(); if ( attrs ) { - string attr_tags; - string attr_vals; - BuildAttrs(attrs, attr_tags, attr_vals); - Emit("assign_attrs__CPP(%s, %s, %s);", globals[g->Name()], attr_tags, attr_vals); + auto attrs_offset = AttributesOffset(attrs); + auto attrs_str = "CPP__Attributes__[" + Fmt(attrs_offset) + "]"; + Emit("%s->SetAttrs(%s);", globals[g->Name()], attrs_str); } } diff --git a/src/script_opt/CPP/RuntimeOps.cc b/src/script_opt/CPP/RuntimeOps.cc index 03973a2e74..47d0585e6d 100644 --- a/src/script_opt/CPP/RuntimeOps.cc +++ b/src/script_opt/CPP/RuntimeOps.cc @@ -239,10 +239,6 @@ TableValPtr table_constructor__CPP(vector indices, vector vals, return aggr; } -void assign_attrs__CPP(IDPtr id, IntVec attr_tags, ValVec attr_vals) { - id->SetAttrs(build_attrs__CPP(std::move(attr_tags), std::move(attr_vals))); -} - RecordValPtr record_constructor__CPP(vector vals, RecordTypePtr t) { auto rv = make_intrusive(t); auto n = vals.size(); diff --git a/src/script_opt/CPP/RuntimeOps.h b/src/script_opt/CPP/RuntimeOps.h index 6a31f8c1a7..2f7eef45b1 100644 --- a/src/script_opt/CPP/RuntimeOps.h +++ b/src/script_opt/CPP/RuntimeOps.h @@ -229,9 +229,6 @@ extern TableValPtr set_constructor__CPP(ValVec elements, TableTypePtr t, IntVec extern TableValPtr table_constructor__CPP(ValVec indices, ValVec vals, TableTypePtr t, IntVec attr_tags, ValVec attr_vals); -// Assigns a set of attributes to an identifier. -extern void assign_attrs__CPP(IDPtr id, IntVec attr_tags, ValVec attr_vals); - // Constructs a record of the given type, whose (ordered) fields are // assigned to the corresponding elements of the given vector of values. extern RecordValPtr record_constructor__CPP(ValVec vals, RecordTypePtr t);