Merge remote-tracking branch 'origin/topic/vern/CPP-standalone-maint'

* origin/topic/vern/CPP-standalone-maint:
  fixes for compiling "standalone" C++ scripts
This commit is contained in:
Christian Kreibich 2022-09-30 16:40:22 -07:00
commit d59bb8cc2c
6 changed files with 21 additions and 2 deletions

View file

@ -1,3 +1,7 @@
5.2.0-dev.35 | 2022-09-30 16:40:22 -0700
* fixes for compiling "standalone" C++ scripts (Vern Paxson, Corelight)
5.2.0-dev.33 | 2022-09-30 12:36:34 -0700
* fix for deprecated when's where the inner frame is larger than the outer frame (Vern Paxson, Corelight)

View file

@ -1 +1 @@
5.2.0-dev.33
5.2.0-dev.35

View file

@ -278,6 +278,15 @@ detail::TraversalCode Type::Traverse(detail::TraversalCallback* cb) const
HANDLE_TC_TYPE_POST(tc);
}
void TypeList::CheckPure()
{
if ( pure_type )
return;
if ( ! types.empty() && AllMatch(types[0], false) )
pure_type = types[0];
}
bool TypeList::AllMatch(const Type* t, bool is_init) const
{
for ( const auto& type : types )

View file

@ -339,6 +339,10 @@ public:
// is not pure or is empty.
const TypePtr& GetPureType() const { return pure_type; }
// Retrospectively instantiates an underlying pure type, if in
// fact each element has the same type.
void CheckPure();
// True if all of the types match t, false otherwise. If
// is_init is true, then the matching is done in the context
// of an initialization.

View file

@ -377,6 +377,8 @@ TypePtr CPP_TypeInits::BuildTypeList(InitsManager* im, ValElemVec& init_vals, in
while ( iv_it != iv_end )
tl->Append(im->Types(*(iv_it++)));
tl->CheckPure();
return tl;
}

View file

@ -412,7 +412,7 @@ static void use_CPP()
}
}
if ( num_used == 0 )
if ( num_used == 0 && standalone_activations.empty() )
reporter->FatalError("no C++ functions found to use");
// Now that we've loaded all of the compiled scripts