Review cleanup

This commit is contained in:
Tim Wojtulewicz 2020-06-10 11:08:56 -07:00
parent ed13972924
commit bac318475a
6 changed files with 21 additions and 14 deletions

View file

@ -252,7 +252,7 @@ void ProfileLogger::Log()
for ( const auto& global : globals ) for ( const auto& global : globals )
{ {
auto id = global.second; auto& id = global.second;
// We don't show/count internal globals as they are always // We don't show/count internal globals as they are always
// contained in some other global user-visible container. // contained in some other global user-visible container.

View file

@ -21,7 +21,6 @@ FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
FORWARD_DECLARE_NAMESPACED(ListExpr, zeek::detail); FORWARD_DECLARE_NAMESPACED(ListExpr, zeek::detail);
FORWARD_DECLARE_NAMESPACED(Attributes, zeek::detail); FORWARD_DECLARE_NAMESPACED(Attributes, zeek::detail);
// BRO types.
enum [[deprecated("Remove in v4.1. Use zeek::TypeTag instead.")]] TypeTag { enum [[deprecated("Remove in v4.1. Use zeek::TypeTag instead.")]] TypeTag {
TYPE_VOID, // 0 TYPE_VOID, // 0
TYPE_BOOL, // 1 TYPE_BOOL, // 1
@ -977,17 +976,17 @@ inline bool EitherError(TypeTag t1, TypeTag t2) { return (IsErrorType(t1) || IsE
// Returns the basic (non-parameterized) type with the given type. // Returns the basic (non-parameterized) type with the given type.
const IntrusivePtr<zeek::BroType>& base_type(zeek::TypeTag tag); const IntrusivePtr<zeek::BroType>& base_type(zeek::TypeTag tag);
// Returns the basic (non-parameterized) type with the given type.
// The reference count of the type is not increased.
[[deprecated("Remove in v4.1. Use ::base_type() instead")]]
inline zeek::BroType* base_type_no_ref(TypeTag tag)
{ return base_type(tag).get(); }
// Returns the basic error type. // Returns the basic error type.
inline const IntrusivePtr<zeek::BroType>& error_type() { return base_type(TYPE_ERROR); } inline const IntrusivePtr<zeek::BroType>& error_type() { return base_type(TYPE_ERROR); }
} // namespace zeek } // namespace zeek
// Returns the basic (non-parameterized) type with the given type.
// The reference count of the type is not increased.
[[deprecated("Remove in v4.1. Use zeek::base_type() instead")]]
inline zeek::BroType* base_type_no_ref(TypeTag tag)
{ return zeek::base_type(static_cast<zeek::TypeTag>(tag)).get(); }
extern IntrusivePtr<zeek::OpaqueType> md5_type; extern IntrusivePtr<zeek::OpaqueType> md5_type;
extern IntrusivePtr<zeek::OpaqueType> sha1_type; extern IntrusivePtr<zeek::OpaqueType> sha1_type;
extern IntrusivePtr<zeek::OpaqueType> sha256_type; extern IntrusivePtr<zeek::OpaqueType> sha256_type;

View file

@ -125,7 +125,7 @@ public:
: val(d), type(zeek::base_type(t)) : val(d), type(zeek::base_type(t))
{} {}
[[deprecated("Remove in v4.1. Use version that takes zeek::TypeTag instead.")]] [[deprecated("Remove in v4.1. Use IntervalVal(), TimeVal(), or DoubleVal() constructors.")]]
Val(double d, ::TypeTag t) : Val(d, static_cast<zeek::TypeTag>(t)) Val(double d, ::TypeTag t) : Val(d, static_cast<zeek::TypeTag>(t))
{} {}
@ -1004,7 +1004,7 @@ public:
notifier::Modifiable* Modifiable() override { return this; } notifier::Modifiable* Modifiable() override { return this; }
// Retrieves and saves all table state (key-value pairs) for // Retrieves and saves all table state (key-value pairs) for
// tables whose index type depends on the given zeek::detail::RecordType. // tables whose index type depends on the given zeek::RecordType.
static void SaveParseTimeTableState(zeek::RecordType* rt); static void SaveParseTimeTableState(zeek::RecordType* rt);
// Rebuilds all TableVals whose state was previously saved by // Rebuilds all TableVals whose state was previously saved by
@ -1013,7 +1013,7 @@ public:
static void RebuildParseTimeTables(); static void RebuildParseTimeTables();
// Clears all state that was used to track TableVals that depending // Clears all state that was used to track TableVals that depending
// on zeek::detail::RecordTypes. // on zeek::RecordTypes.
static void DoneParsing(); static void DoneParsing();
protected: protected:

View file

@ -31,7 +31,7 @@ Config::Config(ReaderFrontend *frontend) : ReaderBackend(frontend)
for ( const auto& entry : globals ) for ( const auto& entry : globals )
{ {
auto id = entry.second; auto& id = entry.second;
if ( ! id->IsOption() ) if ( ! id->IsOption() )
continue; continue;

View file

@ -471,10 +471,18 @@ void Plugin::MetaHookPost(::plugin::HookType hook, const HookArgumentList& args,
void Plugin::MetaHookPre(::zeek::plugin::HookType hook, const HookArgumentList& args) void Plugin::MetaHookPre(::zeek::plugin::HookType hook, const HookArgumentList& args)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
MetaHookPre(static_cast<::plugin::HookType>(hook), args);
#pragma GCC diagnostic pop
} }
void Plugin::MetaHookPost(::zeek::plugin::HookType hook, const HookArgumentList& args, HookArgument result) void Plugin::MetaHookPost(::zeek::plugin::HookType hook, const HookArgumentList& args, HookArgument result)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
MetaHookPost(static_cast<::plugin::HookType>(hook), args, result);
#pragma GCC diagnostic pop
} }
void Plugin::InitializeComponents() void Plugin::InitializeComponents()

View file

@ -1918,7 +1918,7 @@ function global_sizes%(%): var_sizes
for ( const auto& global : globals ) for ( const auto& global : globals )
{ {
auto id = global.second; auto& id = global.second;
if ( id->HasVal() ) if ( id->HasVal() )
{ {
auto id_name = make_intrusive<StringVal>(id->Name()); auto id_name = make_intrusive<StringVal>(id->Name());
@ -1946,7 +1946,7 @@ function global_ids%(%): id_table
for ( const auto& global : globals ) for ( const auto& global : globals )
{ {
zeek::detail::ID* id = global.second.get(); const auto& id = global.second;
static auto script_id = zeek::id::find_type<zeek::RecordType>("script_id"); static auto script_id = zeek::id::find_type<zeek::RecordType>("script_id");
auto rec = make_intrusive<RecordVal>(script_id); auto rec = make_intrusive<RecordVal>(script_id);
rec->Assign(0, make_intrusive<StringVal>(type_name(id->GetType()->Tag()))); rec->Assign(0, make_intrusive<StringVal>(type_name(id->GetType()->Tag())));