Merge remote-tracking branch 'origin/topic/vern/standalone-enum-fix'
Some checks failed
pre-commit / pre-commit (push) Has been cancelled

* origin/topic/vern/standalone-enum-fix:
  fix to enable -O gen-standalone-C++ code to extend enum types
This commit is contained in:
Tim Wojtulewicz 2025-10-03 14:07:06 -07:00
commit 8a1937a0e0
3 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,7 @@
8.1.0-dev.631 | 2025-10-03 14:07:06 -0700
* fix to enable -O gen-standalone-C++ code to extend enum types (Vern Paxson, Corelight)
8.1.0-dev.629 | 2025-10-03 09:13:28 -0700
* Fix some recent Coverity findings (Tim Wojtulewicz, Corelight)

View file

@ -1 +1 @@
8.1.0-dev.629
8.1.0-dev.631

View file

@ -1700,8 +1700,11 @@ void EnumType::AddNameInternal(const string& full_name, zeek_int_t val) {
names[full_name] = val;
rev_names[val] = full_name;
if ( ! vals.contains(val) )
if ( ! vals.contains(val) ) {
if ( counter >= 0 && val == static_cast<zeek_int_t>(vals.size()) )
++counter;
vals[val] = make_intrusive<EnumVal>(IntrusivePtr{NewRef{}, this}, val);
}
}
zeek_int_t EnumType::Lookup(const string& module_name, const char* name) const {