Disable some deprecation diagnostics for GCC

Clang automatically disables deprecation warnings for types used within
already-deprecated contexts, such as if you use a deprecated type inside
of a method that's beeen marked as deprecated. GCC doesn't have this
feature so it spews a lot more warnings. These functions are now wrapped
in pragmas that disable the warnings for the usage.
This commit is contained in:
Tim Wojtulewicz 2020-06-11 15:43:11 -07:00
parent 137e416a03
commit 149e3b3c32
19 changed files with 275 additions and 135 deletions

View file

@ -32,18 +32,21 @@ Attr::Attr(attr_tag t, IntrusivePtr<Expr> e)
SetLocationInfo(&start_location, &end_location); SetLocationInfo(&start_location, &end_location);
} }
Attr::Attr(::attr_tag t, IntrusivePtr<Expr> e) : Attr(static_cast<attr_tag>(t), e) Attr::Attr(attr_tag t)
: Attr(t, nullptr)
{ {
} }
Attr::Attr(attr_tag t) #pragma GCC diagnostic push
: Attr(t, nullptr) #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Attr::Attr(::attr_tag t, IntrusivePtr<Expr> e) : Attr(static_cast<attr_tag>(t), e)
{ {
} }
Attr::Attr(::attr_tag t) : Attr(static_cast<attr_tag>(t)) Attr::Attr(::attr_tag t) : Attr(static_cast<attr_tag>(t))
{ {
} }
#pragma GCC diagnostic pop
Attr::~Attr() = default; Attr::~Attr() = default;
@ -243,11 +246,6 @@ const IntrusivePtr<Attr>& Attributes::Find(attr_tag t) const
return Attr::nil; return Attr::nil;
} }
Attr* Attributes::FindAttr(::attr_tag t) const
{
return FindAttr(static_cast<attr_tag>(t));
}
void Attributes::RemoveAttr(attr_tag t) void Attributes::RemoveAttr(attr_tag t)
{ {
for ( auto it = attrs.begin(); it != attrs.end(); ) for ( auto it = attrs.begin(); it != attrs.end(); )
@ -259,10 +257,18 @@ void Attributes::RemoveAttr(attr_tag t)
} }
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Attr* Attributes::FindAttr(::attr_tag t) const
{
return FindAttr(static_cast<attr_tag>(t));
}
void Attributes::RemoveAttr(::attr_tag t) void Attributes::RemoveAttr(::attr_tag t)
{ {
RemoveAttr(static_cast<attr_tag>(t)); RemoveAttr(static_cast<attr_tag>(t));
} }
#pragma GCC diagnostic pop
void Attributes::Describe(ODesc* d) const void Attributes::Describe(ODesc* d) const
{ {

View file

@ -65,12 +65,16 @@ public:
static inline const IntrusivePtr<zeek::detail::Attr> nil; static inline const IntrusivePtr<zeek::detail::Attr> nil;
Attr(attr_tag t, IntrusivePtr<zeek::detail::Expr> e); Attr(attr_tag t, IntrusivePtr<zeek::detail::Expr> e);
explicit Attr(attr_tag t);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]]
Attr(::attr_tag t, IntrusivePtr<zeek::detail::Expr> e); Attr(::attr_tag t, IntrusivePtr<zeek::detail::Expr> e);
explicit Attr(attr_tag t);
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]]
explicit Attr(::attr_tag t); explicit Attr(::attr_tag t);
#pragma GCC diagnostic pop
~Attr() override; ~Attr() override;
@ -127,14 +131,18 @@ public:
[[deprecated("Remove in v4.1. Use Find().")]] [[deprecated("Remove in v4.1. Use Find().")]]
Attr* FindAttr(attr_tag t) const; Attr* FindAttr(attr_tag t) const;
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]]
Attr* FindAttr(::attr_tag t) const;
const IntrusivePtr<Attr>& Find(attr_tag t) const; const IntrusivePtr<Attr>& Find(attr_tag t) const;
void RemoveAttr(attr_tag t); void RemoveAttr(attr_tag t);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]]
Attr* FindAttr(::attr_tag t) const;
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]]
void RemoveAttr(::attr_tag t); void RemoveAttr(::attr_tag t);
#pragma GCC diagnostic pop
void Describe(ODesc* d) const override; void Describe(ODesc* d) const override;
void DescribeReST(ODesc* d, bool shorten = false) const; void DescribeReST(ODesc* d, bool shorten = false) const;

View file

@ -120,8 +120,11 @@ ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export)
SetLocationInfo(&start_location, &end_location); SetLocationInfo(&start_location, &end_location);
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
ID::ID(const char* arg_name, ::IDScope arg_scope, bool arg_is_export) : ID::ID(const char* arg_name, ::IDScope arg_scope, bool arg_is_export) :
ID(arg_name, static_cast<IDScope>(arg_scope), arg_is_export) {} ID(arg_name, static_cast<IDScope>(arg_scope), arg_is_export) {}
#pragma GCC diagnostic pop
ID::~ID() ID::~ID()
{ {
@ -220,6 +223,8 @@ void ID::SetVal(IntrusivePtr<Expr> ev, init_class c)
EvalFunc(a->GetExpr(), std::move(ev)); EvalFunc(a->GetExpr(), std::move(ev));
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void ID::SetVal(IntrusivePtr<Val> v, ::init_class c) void ID::SetVal(IntrusivePtr<Val> v, ::init_class c)
{ {
SetVal(v, static_cast<init_class>(c)); SetVal(v, static_cast<init_class>(c));
@ -229,6 +234,7 @@ void ID::SetVal(IntrusivePtr<Expr> ev, ::init_class c)
{ {
SetVal(ev, static_cast<init_class>(c)); SetVal(ev, static_cast<init_class>(c));
} }
#pragma GCC diagnostic pop
bool ID::IsRedefinable() const bool ID::IsRedefinable() const
{ {
@ -337,10 +343,13 @@ void ID::RemoveAttr(attr_tag a)
attrs->RemoveAttr(a); attrs->RemoveAttr(a);
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void ID::RemoveAttr(::attr_tag a) void ID::RemoveAttr(::attr_tag a)
{ {
RemoveAttr(static_cast<attr_tag>(a)); RemoveAttr(static_cast<attr_tag>(a));
} }
#pragma GCC diagnostic pop
void ID::SetOption() void ID::SetOption()
{ {

View file

@ -41,8 +41,11 @@ public:
ID(const char* name, IDScope arg_scope, bool arg_is_export); ID(const char* name, IDScope arg_scope, bool arg_is_export);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::IDScope")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::IDScope")]]
ID(const char* name, ::IDScope arg_scope, bool arg_is_export); ID(const char* name, ::IDScope arg_scope, bool arg_is_export);
#pragma GCC diagnostic pop
~ID() override; ~ID() override;
@ -85,10 +88,13 @@ public:
void SetVal(IntrusivePtr<Val> v, init_class c); void SetVal(IntrusivePtr<Val> v, init_class c);
void SetVal(IntrusivePtr<Expr> ev, init_class c); void SetVal(IntrusivePtr<Expr> ev, init_class c);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::init_class")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::init_class")]]
void SetVal(IntrusivePtr<Val> v, ::init_class c); void SetVal(IntrusivePtr<Val> v, ::init_class c);
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::init_class")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::init_class")]]
void SetVal(IntrusivePtr<Expr> ev, ::init_class c); void SetVal(IntrusivePtr<Expr> ev, ::init_class c);
#pragma GCC diagnostic pop
bool HasVal() const { return val != nullptr; } bool HasVal() const { return val != nullptr; }
@ -119,8 +125,11 @@ public:
void SetAttrs(IntrusivePtr<Attributes> attr); void SetAttrs(IntrusivePtr<Attributes> attr);
void AddAttrs(IntrusivePtr<Attributes> attr); void AddAttrs(IntrusivePtr<Attributes> attr);
void RemoveAttr(attr_tag a); void RemoveAttr(attr_tag a);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag")]]
void RemoveAttr(::attr_tag a); void RemoveAttr(::attr_tag a);
#pragma GCC diagnostic pop
void UpdateValAttrs(); void UpdateValAttrs();
const IntrusivePtr<Attributes>& GetAttrs() const const IntrusivePtr<Attributes>& GetAttrs() const
@ -129,9 +138,12 @@ public:
[[deprecated("Remove in 4.1. Use GetAttrs().")]] [[deprecated("Remove in 4.1. Use GetAttrs().")]]
Attributes* Attrs() const { return attrs.get(); } Attributes* Attrs() const { return attrs.get(); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in 4.1. Use GetAttr().")]] [[deprecated("Remove in 4.1. Use GetAttr().")]]
Attr* FindAttr(::attr_tag t) const Attr* FindAttr(::attr_tag t) const
{ return GetAttr(static_cast<zeek::detail::attr_tag>(t)).get(); } { return GetAttr(static_cast<zeek::detail::attr_tag>(t)).get(); }
#pragma GCC diagnostic pop
const IntrusivePtr<zeek::detail::Attr>& GetAttr(zeek::detail::attr_tag t) const; const IntrusivePtr<zeek::detail::Attr>& GetAttr(zeek::detail::attr_tag t) const;

View file

@ -8,27 +8,27 @@
#include "Val.h" #include "Val.h"
#include "ID.h" #include "ID.h"
RecordType* conn_id; zeek::RecordType* conn_id;
RecordType* endpoint; zeek::RecordType* endpoint;
RecordType* endpoint_stats; zeek::RecordType* endpoint_stats;
RecordType* connection_type; zeek::RecordType* connection_type;
RecordType* fa_file_type; zeek::RecordType* fa_file_type;
RecordType* fa_metadata_type; zeek::RecordType* fa_metadata_type;
RecordType* icmp_conn; zeek::RecordType* icmp_conn;
RecordType* icmp_context; zeek::RecordType* icmp_context;
RecordType* SYN_packet; zeek::RecordType* SYN_packet;
RecordType* pcap_packet; zeek::RecordType* pcap_packet;
RecordType* raw_pkt_hdr_type; zeek::RecordType* raw_pkt_hdr_type;
RecordType* l2_hdr_type; zeek::RecordType* l2_hdr_type;
RecordType* signature_state; zeek::RecordType* signature_state;
EnumType* transport_proto; zeek::EnumType* transport_proto;
TableType* string_set; zeek::TableType* string_set;
TableType* string_array; zeek::TableType* string_array;
TableType* count_set; zeek::TableType* count_set;
VectorType* string_vec; zeek::VectorType* string_vec;
VectorType* index_vec; zeek::VectorType* index_vec;
VectorType* mime_matches; zeek::VectorType* mime_matches;
RecordType* mime_match; zeek::RecordType* mime_match;
int watchdog_interval; int watchdog_interval;
@ -56,7 +56,7 @@ int tcp_max_above_hole_without_any_acks;
int tcp_excessive_data_without_further_acks; int tcp_excessive_data_without_further_acks;
int tcp_max_old_segments; int tcp_max_old_segments;
RecordType* socks_address; zeek::RecordType* socks_address;
double non_analyzed_lifetime; double non_analyzed_lifetime;
double tcp_inactivity_timeout; double tcp_inactivity_timeout;
@ -86,32 +86,32 @@ double rpc_timeout;
int mime_segment_length; int mime_segment_length;
int mime_segment_overlap_length; int mime_segment_overlap_length;
RecordType* mime_header_rec; zeek::RecordType* mime_header_rec;
TableType* mime_header_list; zeek::TableType* mime_header_list;
int http_entity_data_delivery_size; int http_entity_data_delivery_size;
RecordType* http_stats_rec; zeek::RecordType* http_stats_rec;
RecordType* http_message_stat; zeek::RecordType* http_message_stat;
int truncate_http_URI; int truncate_http_URI;
RecordType* pm_mapping; zeek::RecordType* pm_mapping;
TableType* pm_mappings; zeek::TableType* pm_mappings;
RecordType* pm_port_request; zeek::RecordType* pm_port_request;
RecordType* pm_callit_request; zeek::RecordType* pm_callit_request;
RecordType* geo_location; zeek::RecordType* geo_location;
RecordType* entropy_test_result; zeek::RecordType* entropy_test_result;
RecordType* dns_msg; zeek::RecordType* dns_msg;
RecordType* dns_answer; zeek::RecordType* dns_answer;
RecordType* dns_soa; zeek::RecordType* dns_soa;
RecordType* dns_edns_additional; zeek::RecordType* dns_edns_additional;
RecordType* dns_tsig_additional; zeek::RecordType* dns_tsig_additional;
RecordType* dns_rrsig_rr; zeek::RecordType* dns_rrsig_rr;
RecordType* dns_dnskey_rr; zeek::RecordType* dns_dnskey_rr;
RecordType* dns_nsec3_rr; zeek::RecordType* dns_nsec3_rr;
RecordType* dns_ds_rr; zeek::RecordType* dns_ds_rr;
TableVal* dns_skip_auth; TableVal* dns_skip_auth;
TableVal* dns_skip_addl; TableVal* dns_skip_addl;
int dns_skip_all_auth; int dns_skip_all_auth;
@ -134,7 +134,7 @@ TableVal* preserve_orig_addr;
TableVal* preserve_resp_addr; TableVal* preserve_resp_addr;
TableVal* preserve_other_addr; TableVal* preserve_other_addr;
RecordType* rotate_info; zeek::RecordType* rotate_info;
StringVal* log_rotate_base_time; StringVal* log_rotate_base_time;
StringVal* peer_description; StringVal* peer_description;
@ -153,8 +153,8 @@ int packet_filter_default;
int sig_max_group_size; int sig_max_group_size;
TableType* irc_join_list; zeek::TableType* irc_join_list;
RecordType* irc_join_info; zeek::RecordType* irc_join_info;
int dpd_reassemble_first_packets; int dpd_reassemble_first_packets;
int dpd_buffer_size; int dpd_buffer_size;
@ -172,12 +172,12 @@ StringVal* trace_output_file;
int record_all_packets; int record_all_packets;
RecordType* script_id; zeek::RecordType* script_id;
TableType* id_table; zeek::TableType* id_table;
RecordType* record_field; zeek::RecordType* record_field;
TableType* record_field_table; zeek::TableType* record_field_table;
RecordType* call_argument; zeek::RecordType* call_argument;
VectorType* call_argument_vector; zeek::VectorType* call_argument_vector;
StringVal* cmd_line_bpf_filter; StringVal* cmd_line_bpf_filter;

View file

@ -7,47 +7,47 @@
#include "Stats.h" #include "Stats.h"
[[deprecated("Remove in v4.1. Use zeek::id::conn_id.")]] [[deprecated("Remove in v4.1. Use zeek::id::conn_id.")]]
extern RecordType* conn_id; extern zeek::RecordType* conn_id;
[[deprecated("Remove in v4.1. Use zeek::id::endpoint.")]] [[deprecated("Remove in v4.1. Use zeek::id::endpoint.")]]
extern RecordType* endpoint; extern zeek::RecordType* endpoint;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* endpoint_stats; extern zeek::RecordType* endpoint_stats;
[[deprecated("Remove in v4.1. Use zeek::id::connection.")]] [[deprecated("Remove in v4.1. Use zeek::id::connection.")]]
extern RecordType* connection_type; extern zeek::RecordType* connection_type;
[[deprecated("Remove in v4.1. Use zeek::id::fa_file.")]] [[deprecated("Remove in v4.1. Use zeek::id::fa_file.")]]
extern RecordType* fa_file_type; extern zeek::RecordType* fa_file_type;
[[deprecated("Remove in v4.1. Use zeek::id::fa_metadata.")]] [[deprecated("Remove in v4.1. Use zeek::id::fa_metadata.")]]
extern RecordType* fa_metadata_type; extern zeek::RecordType* fa_metadata_type;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* icmp_conn; extern zeek::RecordType* icmp_conn;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* icmp_context; extern zeek::RecordType* icmp_context;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* signature_state; extern zeek::RecordType* signature_state;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* SYN_packet; extern zeek::RecordType* SYN_packet;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* pcap_packet; extern zeek::RecordType* pcap_packet;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* raw_pkt_hdr_type; extern zeek::RecordType* raw_pkt_hdr_type;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* l2_hdr_type; extern zeek::RecordType* l2_hdr_type;
[[deprecated("Remove in v4.1. Use zeek::id::transport_proto.")]] [[deprecated("Remove in v4.1. Use zeek::id::transport_proto.")]]
extern EnumType* transport_proto; extern zeek::EnumType* transport_proto;
[[deprecated("Remove in v4.1. Use zeek::id::string_set.")]] [[deprecated("Remove in v4.1. Use zeek::id::string_set.")]]
extern TableType* string_set; extern zeek::TableType* string_set;
[[deprecated("Remove in v4.1. Use zeek::id::string_array.")]] [[deprecated("Remove in v4.1. Use zeek::id::string_array.")]]
extern TableType* string_array; extern zeek::TableType* string_array;
[[deprecated("Remove in v4.1. Use zeek::id::count_set.")]] [[deprecated("Remove in v4.1. Use zeek::id::count_set.")]]
extern TableType* count_set; extern zeek::TableType* count_set;
[[deprecated("Remove in v4.1. Use zeek::id::string_vec.")]] [[deprecated("Remove in v4.1. Use zeek::id::string_vec.")]]
extern VectorType* string_vec; extern zeek::VectorType* string_vec;
[[deprecated("Remove in v4.1. Use zeek::id::index_vec.")]] [[deprecated("Remove in v4.1. Use zeek::id::index_vec.")]]
extern VectorType* index_vec; extern zeek::VectorType* index_vec;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern VectorType* mime_matches; extern zeek::VectorType* mime_matches;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* mime_match; extern zeek::RecordType* mime_match;
extern int watchdog_interval; extern int watchdog_interval;
@ -76,7 +76,7 @@ extern int tcp_excessive_data_without_further_acks;
extern int tcp_max_old_segments; extern int tcp_max_old_segments;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* socks_address; extern zeek::RecordType* socks_address;
extern double non_analyzed_lifetime; extern double non_analyzed_lifetime;
extern double tcp_inactivity_timeout; extern double tcp_inactivity_timeout;
@ -114,50 +114,50 @@ extern double rpc_timeout;
extern int mime_segment_length; extern int mime_segment_length;
extern int mime_segment_overlap_length; extern int mime_segment_overlap_length;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* mime_header_rec; extern zeek::RecordType* mime_header_rec;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern TableType* mime_header_list; extern zeek::TableType* mime_header_list;
extern int http_entity_data_delivery_size; extern int http_entity_data_delivery_size;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* http_stats_rec; extern zeek::RecordType* http_stats_rec;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* http_message_stat; extern zeek::RecordType* http_message_stat;
extern int truncate_http_URI; extern int truncate_http_URI;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* pm_mapping; extern zeek::RecordType* pm_mapping;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern TableType* pm_mappings; extern zeek::TableType* pm_mappings;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* pm_port_request; extern zeek::RecordType* pm_port_request;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* pm_callit_request; extern zeek::RecordType* pm_callit_request;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* geo_location; extern zeek::RecordType* geo_location;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* entropy_test_result; extern zeek::RecordType* entropy_test_result;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_msg; extern zeek::RecordType* dns_msg;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_answer; extern zeek::RecordType* dns_answer;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_soa; extern zeek::RecordType* dns_soa;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_edns_additional; extern zeek::RecordType* dns_edns_additional;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_tsig_additional; extern zeek::RecordType* dns_tsig_additional;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_rrsig_rr; extern zeek::RecordType* dns_rrsig_rr;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_dnskey_rr; extern zeek::RecordType* dns_dnskey_rr;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_nsec3_rr; extern zeek::RecordType* dns_nsec3_rr;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* dns_ds_rr; extern zeek::RecordType* dns_ds_rr;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern TableVal* dns_skip_auth; extern TableVal* dns_skip_auth;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
@ -187,7 +187,7 @@ extern TableVal* preserve_other_addr;
extern double connection_status_update_interval; extern double connection_status_update_interval;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* rotate_info; extern zeek::RecordType* rotate_info;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern StringVal* log_rotate_base_time; extern StringVal* log_rotate_base_time;
@ -212,9 +212,9 @@ extern int packet_filter_default;
extern int sig_max_group_size; extern int sig_max_group_size;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern TableType* irc_join_list; extern zeek::TableType* irc_join_list;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* irc_join_info; extern zeek::RecordType* irc_join_info;
extern int dpd_reassemble_first_packets; extern int dpd_reassemble_first_packets;
extern int dpd_buffer_size; extern int dpd_buffer_size;
@ -235,17 +235,17 @@ extern StringVal* trace_output_file;
extern int record_all_packets; extern int record_all_packets;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* script_id; extern zeek::RecordType* script_id;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern TableType* id_table; extern zeek::TableType* id_table;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* record_field; extern zeek::RecordType* record_field;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern TableType* record_field_table; extern zeek::TableType* record_field_table;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* call_argument; extern zeek::RecordType* call_argument;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern VectorType* call_argument_vector; extern zeek::VectorType* call_argument_vector;
[[deprecated("Remove in v4.1. Perform your own lookup.")]] [[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern StringVal* cmd_line_bpf_filter; extern StringVal* cmd_line_bpf_filter;

View file

@ -190,10 +190,14 @@ public:
static inline const IntrusivePtr<Type> nil; static inline const IntrusivePtr<Type> nil;
explicit Type(zeek::TypeTag tag, bool base_type = false); explicit Type(zeek::TypeTag tag, bool base_type = false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]]
explicit Type(::TypeTag tag, bool base_type = false) explicit Type(::TypeTag tag, bool base_type = false)
: Type(static_cast<zeek::TypeTag>(tag), base_type) : Type(static_cast<zeek::TypeTag>(tag), base_type)
{} {}
#pragma GCC diagnostic pop
// Performs a shallow clone operation of the Bro type. // Performs a shallow clone operation of the Bro type.
// This especially means that especially for tables the types // This especially means that especially for tables the types
@ -528,10 +532,13 @@ public:
FuncType(IntrusivePtr<RecordType> args, IntrusivePtr<Type> yield, FuncType(IntrusivePtr<RecordType> args, IntrusivePtr<Type> yield,
FunctionFlavor f); FunctionFlavor f);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::FunctionFlavor instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::FunctionFlavor instead.")]]
FuncType(IntrusivePtr<RecordType> args, IntrusivePtr<Type> yield, ::function_flavor f) FuncType(IntrusivePtr<RecordType> args, IntrusivePtr<Type> yield, ::function_flavor f)
: FuncType(args, yield, static_cast<FunctionFlavor>(f)) : FuncType(args, yield, static_cast<FunctionFlavor>(f))
{} {}
#pragma GCC diagnostic pop
IntrusivePtr<Type> ShallowClone() override; IntrusivePtr<Type> ShallowClone() override;
@ -554,9 +561,12 @@ public:
void ClearYieldType(FunctionFlavor arg_flav) void ClearYieldType(FunctionFlavor arg_flav)
{ yield = nullptr; flavor = arg_flav; } { yield = nullptr; flavor = arg_flav; }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::FunctionFlavor instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::FunctionFlavor instead.")]]
void ClearYieldType(::function_flavor arg_flav) void ClearYieldType(::function_flavor arg_flav)
{ yield = nullptr; flavor = static_cast<FunctionFlavor>(arg_flav); } { yield = nullptr; flavor = static_cast<FunctionFlavor>(arg_flav); }
#pragma GCC diagnostic pop
int MatchesIndex(zeek::detail::ListExpr* index) const override; int MatchesIndex(zeek::detail::ListExpr* index) const override;
bool CheckArgs(const type_list* args, bool is_init = false) const; bool CheckArgs(const type_list* args, bool is_init = false) const;
@ -628,9 +638,12 @@ public:
TypeDecl(const TypeDecl& other); TypeDecl(const TypeDecl& other);
~TypeDecl(); ~TypeDecl();
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use GetAttr().")]] [[deprecated("Remove in v4.1. Use GetAttr().")]]
const zeek::detail::Attr* FindAttr(::attr_tag a) const const zeek::detail::Attr* FindAttr(::attr_tag a) const
{ return attrs ? attrs->Find(static_cast<zeek::detail::attr_tag>(a)).get() : nullptr; } { return attrs ? attrs->Find(static_cast<zeek::detail::attr_tag>(a)).get() : nullptr; }
#pragma GCC diagnostic pop
const IntrusivePtr<zeek::detail::Attr>& GetAttr(zeek::detail::attr_tag a) const const IntrusivePtr<zeek::detail::Attr>& GetAttr(zeek::detail::attr_tag a) const
{ return attrs ? attrs->Find(a) : zeek::detail::Attr::nil; } { return attrs ? attrs->Find(a) : zeek::detail::Attr::nil; }
@ -738,11 +751,15 @@ public:
const TypeDecl* decl = FieldDecl(field); const TypeDecl* decl = FieldDecl(field);
return decl && decl->GetAttr(at) != nullptr; return decl && decl->GetAttr(at) != nullptr;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]]
bool FieldHasAttr(int field, ::attr_tag at) const bool FieldHasAttr(int field, ::attr_tag at) const
{ {
return FieldHasAttr(field, static_cast<zeek::detail::attr_tag>(at)); return FieldHasAttr(field, static_cast<zeek::detail::attr_tag>(at));
} }
#pragma GCC diagnostic pop
std::string GetFieldDeprecationWarning(int field, bool has_check) const; std::string GetFieldDeprecationWarning(int field, bool has_check) const;
@ -984,7 +1001,7 @@ inline const IntrusivePtr<zeek::Type>& error_type() { return base_type(TYP
// Returns the basic (non-parameterized) type with the given type. // Returns the basic (non-parameterized) type with the given type.
// The reference count of the type is not increased. // The reference count of the type is not increased.
[[deprecated("Remove in v4.1. Use zeek::base_type() instead")]] [[deprecated("Remove in v4.1. Use zeek::base_type() instead")]]
inline zeek::Type* base_type_no_ref(TypeTag tag) inline zeek::Type* base_type_no_ref(zeek::TypeTag tag)
{ return zeek::base_type(static_cast<zeek::TypeTag>(tag)).get(); } { return zeek::base_type(static_cast<zeek::TypeTag>(tag)).get(); }
extern IntrusivePtr<zeek::OpaqueType> md5_type; extern IntrusivePtr<zeek::OpaqueType> md5_type;

View file

@ -125,9 +125,12 @@ public:
: val(d), type(zeek::base_type(t)) : val(d), type(zeek::base_type(t))
{} {}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use IntervalVal(), TimeVal(), or DoubleVal() constructors.")]] [[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))
{} {}
#pragma GCC diagnostic pop
[[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]] [[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]]
explicit Val(Func* f); explicit Val(Func* f);
@ -652,8 +655,13 @@ protected:
class ListVal final : public Val { class ListVal final : public Val {
public: public:
explicit ListVal(zeek::TypeTag t); explicit ListVal(zeek::TypeTag t);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag")]]
explicit ListVal(::TypeTag t) : ListVal(static_cast<zeek::TypeTag>(t)) {} explicit ListVal(::TypeTag t) : ListVal(static_cast<zeek::TypeTag>(t)) {}
#pragma GCC diagnostic pop
~ListVal() override; ~ListVal() override;
zeek::TypeTag BaseTag() const { return tag; } zeek::TypeTag BaseTag() const { return tag; }
@ -766,10 +774,13 @@ class TableVal final : public Val, public notifier::Modifiable {
public: public:
explicit TableVal(IntrusivePtr<zeek::TableType> t, IntrusivePtr<zeek::detail::Attributes> attrs = nullptr); explicit TableVal(IntrusivePtr<zeek::TableType> t, IntrusivePtr<zeek::detail::Attributes> attrs = nullptr);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Construct from IntrusivePtrs instead.")]] [[deprecated("Remove in v4.1. Construct from IntrusivePtrs instead.")]]
explicit TableVal(zeek::TableType* t, Attributes* attrs = nullptr) explicit TableVal(zeek::TableType* t, zeek::detail::Attributes* attrs = nullptr)
: TableVal({NewRef{}, t}, {NewRef{}, attrs}) : TableVal({NewRef{}, t}, {NewRef{}, attrs})
{} {}
#pragma GCC diagnostic pop
~TableVal() override; ~TableVal() override;
@ -952,9 +963,12 @@ public:
void SetAttrs(IntrusivePtr<zeek::detail::Attributes> attrs); void SetAttrs(IntrusivePtr<zeek::detail::Attributes> attrs);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use GetAttr().")]] [[deprecated("Remove in v4.1. Use GetAttr().")]]
Attr* FindAttr(::attr_tag t) const Attr* FindAttr(::attr_tag t) const
{ return GetAttr(static_cast<zeek::detail::attr_tag>(t)).get(); } { return GetAttr(static_cast<zeek::detail::attr_tag>(t)).get(); }
#pragma GCC diagnostic pop
const IntrusivePtr<zeek::detail::Attr>& GetAttr(zeek::detail::attr_tag t) const; const IntrusivePtr<zeek::detail::Attr>& GetAttr(zeek::detail::attr_tag t) const;
@ -1028,8 +1042,11 @@ protected:
void RebuildTable(ParseTimeTableState ptts); void RebuildTable(ParseTimeTableState ptts);
void CheckExpireAttr(zeek::detail::attr_tag at); void CheckExpireAttr(zeek::detail::attr_tag at);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]] [[deprecated("Remove in v4.1. Use version that takes zeek::detail::attr_tag.")]]
void CheckExpireAttr(::attr_tag at); void CheckExpireAttr(::attr_tag at);
#pragma GCC diagnostic pop
bool ExpandCompoundAndInit(ListVal* lv, int k, IntrusivePtr<Val> new_val); bool ExpandCompoundAndInit(ListVal* lv, int k, IntrusivePtr<Val> new_val);
bool CheckAndAssign(IntrusivePtr<Val> index, IntrusivePtr<Val> new_val); bool CheckAndAssign(IntrusivePtr<Val> index, IntrusivePtr<Val> new_val);

View file

@ -236,10 +236,13 @@ public:
it(dat.begin()) it(dat.begin())
{} {}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]]
SetIterator(RecordVal* v, ::TypeTag tag, Frame* f) SetIterator(RecordVal* v, ::TypeTag tag, Frame* f)
: SetIterator(v, static_cast<zeek::TypeTag>(tag), f) : SetIterator(v, static_cast<zeek::TypeTag>(tag), f)
{} {}
#pragma GCC diagnostic pop
broker::set dat; broker::set dat;
broker::set::iterator it; broker::set::iterator it;
@ -261,10 +264,13 @@ public:
it(dat.begin()) it(dat.begin())
{} {}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]]
TableIterator(RecordVal* v, ::TypeTag tag, Frame* f) TableIterator(RecordVal* v, ::TypeTag tag, Frame* f)
: TableIterator(v, static_cast<zeek::TypeTag>(tag), f) : TableIterator(v, static_cast<zeek::TypeTag>(tag), f)
{} {}
#pragma GCC diagnostic pop
broker::table dat; broker::table dat;
broker::table::iterator it; broker::table::iterator it;
@ -286,10 +292,13 @@ public:
it(dat.begin()) it(dat.begin())
{} {}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]]
VectorIterator(RecordVal* v, ::TypeTag tag, Frame* f) VectorIterator(RecordVal* v, ::TypeTag tag, Frame* f)
: VectorIterator(v, static_cast<zeek::TypeTag>(tag), f) : VectorIterator(v, static_cast<zeek::TypeTag>(tag), f)
{} {}
#pragma GCC diagnostic pop
broker::vector dat; broker::vector dat;
broker::vector::iterator it; broker::vector::iterator it;
@ -311,10 +320,13 @@ public:
it(dat.begin()) it(dat.begin())
{} {}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]]
RecordIterator(RecordVal* v, ::TypeTag tag, Frame* f) RecordIterator(RecordVal* v, ::TypeTag tag, Frame* f)
: RecordIterator(v, static_cast<zeek::TypeTag>(tag), f) : RecordIterator(v, static_cast<zeek::TypeTag>(tag), f)
{} {}
#pragma GCC diagnostic pop
broker::vector dat; broker::vector dat;
broker::vector::iterator it; broker::vector::iterator it;

View file

@ -25,6 +25,8 @@ struct FieldMapping {
FieldMapping(const std::string& arg_name, const zeek::TypeTag& arg_type, int arg_position); FieldMapping(const std::string& arg_name, const zeek::TypeTag& arg_type, int arg_position);
FieldMapping(const std::string& arg_name, const zeek::TypeTag& arg_type, const zeek::TypeTag& arg_subtype, int arg_position); FieldMapping(const std::string& arg_name, const zeek::TypeTag& arg_type, const zeek::TypeTag& arg_subtype, int arg_position);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek:TypeTag.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek:TypeTag.")]]
FieldMapping(const std::string& arg_name, const ::TypeTag& arg_type, int arg_position) FieldMapping(const std::string& arg_name, const ::TypeTag& arg_type, int arg_position)
: FieldMapping(arg_name, static_cast<zeek::TypeTag>(arg_type), arg_position) : FieldMapping(arg_name, static_cast<zeek::TypeTag>(arg_type), arg_position)
@ -34,6 +36,7 @@ struct FieldMapping {
FieldMapping(const std::string& arg_name, const ::TypeTag& arg_type, const ::TypeTag& arg_subtype, int arg_position) FieldMapping(const std::string& arg_name, const ::TypeTag& arg_type, const ::TypeTag& arg_subtype, int arg_position)
: FieldMapping(arg_name, static_cast<zeek::TypeTag>(arg_type), static_cast<zeek::TypeTag>(arg_subtype), arg_position) : FieldMapping(arg_name, static_cast<zeek::TypeTag>(arg_type), static_cast<zeek::TypeTag>(arg_subtype), arg_position)
{} {}
#pragma GCC diagnostic pop
FieldMapping(const FieldMapping& arg); FieldMapping(const FieldMapping& arg);
FieldMapping() { position = -1; secondary_position = -1; } FieldMapping() { position = -1; secondary_position = -1; }

View file

@ -17,10 +17,13 @@ Component::Component(zeek::plugin::component::Type type, const std::string& name
{ {
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Component::Component(plugin::component::Type type, const std::string& name) Component::Component(plugin::component::Type type, const std::string& name)
: plugin::Component(static_cast<zeek::plugin::component::Type>(type), name) : plugin::Component(static_cast<zeek::plugin::component::Type>(type), name)
{ {
} }
#pragma GCC diagnostic pop
Component::~Component() Component::~Component()
{ {

View file

@ -53,8 +53,11 @@ protected:
* @param name A descriptive name for the component. This name must * @param name A descriptive name for the component. This name must
* be unique across all components of this type. * be unique across all components of this type.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::component::Type instead")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::component::Type instead")]]
Component(plugin::component::Type type, const std::string& name); Component(plugin::component::Type type, const std::string& name);
#pragma GCC diagnostic pop
}; };
/** /**

View file

@ -14,12 +14,15 @@ Component::Component(component::Type arg_type, const std::string& arg_name)
canon_name = canonify_name(name); canon_name = canonify_name(name);
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Component::Component(::plugin::component::Type arg_type, const std::string& arg_name) Component::Component(::plugin::component::Type arg_type, const std::string& arg_name)
{ {
type = static_cast<component::Type>(arg_type); type = static_cast<component::Type>(arg_type);
name = arg_name; name = arg_name;
canon_name = canonify_name(name); canon_name = canonify_name(name);
} }
#pragma GCC diagnostic pop
Component::~Component() Component::~Component()
{ {

View file

@ -65,8 +65,11 @@ public:
* @param name A descriptive name for the component. This name must * @param name A descriptive name for the component. This name must
* be unique across all components of the same type. * be unique across all components of the same type.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::component::Type instead")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::component::Type instead")]]
Component(::plugin::component::Type type, const std::string& name); Component(::plugin::component::Type type, const std::string& name);
#pragma GCC diagnostic pop
/** /**
* Destructor. * Destructor.

View file

@ -530,11 +530,6 @@ std::list<std::pair<::zeek::plugin::HookType, int> > Manager::HooksEnabledForPlu
return enabled; return enabled;
} }
void Manager::EnableHook(::plugin::HookType hook, Plugin* plugin, int prio)
{
EnableHook(static_cast<zeek::plugin::HookType>(hook), plugin, prio);
}
void Manager::EnableHook(zeek::plugin::HookType hook, Plugin* plugin, int prio) void Manager::EnableHook(zeek::plugin::HookType hook, Plugin* plugin, int prio)
{ {
if ( ! hooks[hook] ) if ( ! hooks[hook] )
@ -553,11 +548,6 @@ void Manager::EnableHook(zeek::plugin::HookType hook, Plugin* plugin, int prio)
l->sort(hook_cmp); l->sort(hook_cmp);
} }
void Manager::DisableHook(::plugin::HookType hook, Plugin* plugin)
{
DisableHook(static_cast<zeek::plugin::HookType>(hook), plugin);
}
void Manager::DisableHook(zeek::plugin::HookType hook, Plugin* plugin) void Manager::DisableHook(zeek::plugin::HookType hook, Plugin* plugin)
{ {
hook_list* l = hooks[hook]; hook_list* l = hooks[hook];
@ -581,6 +571,19 @@ void Manager::DisableHook(zeek::plugin::HookType hook, Plugin* plugin)
} }
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void Manager::EnableHook(::plugin::HookType hook, Plugin* plugin, int prio)
{
EnableHook(static_cast<zeek::plugin::HookType>(hook), plugin, prio);
}
void Manager::DisableHook(::plugin::HookType hook, Plugin* plugin)
{
DisableHook(static_cast<zeek::plugin::HookType>(hook), plugin);
}
#pragma GCC diagnostic pop
void Manager::RequestEvent(EventHandlerPtr handler, Plugin* plugin) void Manager::RequestEvent(EventHandlerPtr handler, Plugin* plugin)
{ {
DBG_LOG(DBG_PLUGINS, "Plugin %s requested event %s", DBG_LOG(DBG_PLUGINS, "Plugin %s requested event %s",

View file

@ -171,12 +171,15 @@ public:
return hooks[hook] != nullptr; return hooks[hook] != nullptr;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]]
bool HavePluginForHook(::plugin::HookType hook) const bool HavePluginForHook(::plugin::HookType hook) const
{ {
// Inline to avoid the function call. // Inline to avoid the function call.
return HavePluginForHook(static_cast<zeek::plugin::HookType>(hook)); return HavePluginForHook(static_cast<zeek::plugin::HookType>(hook));
} }
#pragma GCC diagnostic pop
/** /**
* Returns all the hooks, with their priorities, that are currently * Returns all the hooks, with their priorities, that are currently
@ -195,8 +198,6 @@ public:
* *
* prio: The priority to associate with the plugin for this hook. * prio: The priority to associate with the plugin for this hook.
*/ */
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]]
void EnableHook(::plugin::HookType hook, Plugin* plugin, int prio);
void EnableHook(::zeek::plugin::HookType hook, Plugin* plugin, int prio); void EnableHook(::zeek::plugin::HookType hook, Plugin* plugin, int prio);
/** /**
@ -206,9 +207,16 @@ public:
* *
* plugin: The plugin that used to define the hook. * plugin: The plugin that used to define the hook.
*/ */
void DisableHook(::zeek::plugin::HookType hook, Plugin* plugin);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]]
void EnableHook(::plugin::HookType hook, Plugin* plugin, int prio);
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]]
void DisableHook(::plugin::HookType hook, Plugin* plugin); void DisableHook(::plugin::HookType hook, Plugin* plugin);
void DisableHook(::zeek::plugin::HookType hook, Plugin* plugin); #pragma GCC diagnostic pop
/** /**
* Registers interest in an event by a plugin, even if there's no handler * Registers interest in an event by a plugin, even if there's no handler

View file

@ -42,10 +42,13 @@ static constexpr const char* hook_names[int(::zeek::plugin::NUM_HOOKS) + 1] = {
return hook_names[int(h)]; return hook_names[int(h)];
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
const char* plugin::hook_name(::plugin::HookType h) const char* plugin::hook_name(::plugin::HookType h)
{ {
return hook_name(static_cast<::zeek::plugin::HookType>(h)); return hook_name(static_cast<::zeek::plugin::HookType>(h));
} }
#pragma GCC diagnostic pop
BifItem::BifItem(const std::string& arg_id, Type arg_type) BifItem::BifItem(const std::string& arg_id, Type arg_type)
{ {
@ -355,20 +358,23 @@ Plugin::hook_list Plugin::EnabledHooks() const
return plugin_mgr->HooksEnabledForPlugin(this); return plugin_mgr->HooksEnabledForPlugin(this);
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void Plugin::EnableHook(::plugin::HookType hook, int priority) void Plugin::EnableHook(::plugin::HookType hook, int priority)
{ {
plugin_mgr->EnableHook(static_cast<zeek::plugin::HookType>(hook), this, priority); plugin_mgr->EnableHook(static_cast<zeek::plugin::HookType>(hook), this, priority);
} }
void Plugin::EnableHook(::zeek::plugin::HookType hook, int priority)
{
plugin_mgr->EnableHook(hook, this, priority);
}
void Plugin::DisableHook(::plugin::HookType hook) void Plugin::DisableHook(::plugin::HookType hook)
{ {
plugin_mgr->DisableHook(static_cast<zeek::plugin::HookType>(hook), this); plugin_mgr->DisableHook(static_cast<zeek::plugin::HookType>(hook), this);
} }
#pragma GCC diagnostic pop
void Plugin::EnableHook(::zeek::plugin::HookType hook, int priority)
{
plugin_mgr->EnableHook(hook, this, priority);
}
void Plugin::DisableHook(::zeek::plugin::HookType hook) void Plugin::DisableHook(::zeek::plugin::HookType hook)
{ {
@ -461,6 +467,8 @@ bool Plugin::HookReporter(const std::string& prefix, const EventHandlerPtr event
return true; return true;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void Plugin::MetaHookPre(::plugin::HookType hook, const HookArgumentList& args) void Plugin::MetaHookPre(::plugin::HookType hook, const HookArgumentList& args)
{ {
} }
@ -468,6 +476,7 @@ void Plugin::MetaHookPre(::plugin::HookType hook, const HookArgumentList& args)
void Plugin::MetaHookPost(::plugin::HookType hook, const HookArgumentList& args, HookArgument result) void Plugin::MetaHookPost(::plugin::HookType hook, const HookArgumentList& args, HookArgument result)
{ {
} }
#pragma GCC diagnostic pop
void Plugin::MetaHookPre(::zeek::plugin::HookType hook, const HookArgumentList& args) void Plugin::MetaHookPre(::zeek::plugin::HookType hook, const HookArgumentList& args)
{ {

View file

@ -56,8 +56,11 @@ enum [[deprecated("Remove in v4.1. Use the zeek::plugin::HookType instead.")]] H
/** /**
* Converts a hook type into a readable hook name. * Converts a hook type into a readable hook name.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
extern const char* hook_name(::plugin::HookType h); extern const char* hook_name(::plugin::HookType h);
#pragma GCC diagnostic pop
} }
@ -615,8 +618,6 @@ protected:
* highest to lowest. If two plugins specify the same priority, order * highest to lowest. If two plugins specify the same priority, order
* is undefined. * is undefined.
*/ */
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
void EnableHook(::plugin::HookType hook, int priority = 0);
void EnableHook(zeek::plugin::HookType hook, int priority = 0); void EnableHook(zeek::plugin::HookType hook, int priority = 0);
/** /**
@ -625,9 +626,16 @@ protected:
* *
* @param hook The hook to disable. * @param hook The hook to disable.
*/ */
void DisableHook(zeek::plugin::HookType hook);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
void EnableHook(::plugin::HookType hook, int priority = 0);
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
void DisableHook(::plugin::HookType hook); void DisableHook(::plugin::HookType hook);
void DisableHook(zeek::plugin::HookType hook); #pragma GCC diagnostic pop
/** /**
* Returns a list of hooks that are currently enabled for the plugin, * Returns a list of hooks that are currently enabled for the plugin,
@ -880,9 +888,12 @@ protected:
* *
* args: A list of the hooks arguments. * args: A list of the hooks arguments.
*/ */
// TODO: unfortunately deprecated virtual methods don't flag when you override them #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
virtual void MetaHookPre(::plugin::HookType hook, const HookArgumentList& args); virtual void MetaHookPre(::plugin::HookType hook, const HookArgumentList& args);
#pragma GCC diagnostic pop
virtual void MetaHookPre(::zeek::plugin::HookType hook, const HookArgumentList& args); virtual void MetaHookPre(::zeek::plugin::HookType hook, const HookArgumentList& args);
/** /**
@ -898,8 +909,12 @@ protected:
* implementation for the hook, this will be the default result. If * implementation for the hook, this will be the default result. If
* the hook doesn't yield a result, this will be of type VOID. * the hook doesn't yield a result, this will be of type VOID.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
virtual void MetaHookPost(::plugin::HookType hook, const HookArgumentList& args, HookArgument result); virtual void MetaHookPost(::plugin::HookType hook, const HookArgumentList& args, HookArgument result);
#pragma GCC diagnostic pop
virtual void MetaHookPost(::zeek::plugin::HookType hook, const HookArgumentList& args, HookArgument result); virtual void MetaHookPost(::zeek::plugin::HookType hook, const HookArgumentList& args, HookArgument result);
private: private:

View file

@ -33,10 +33,13 @@ struct Field {
secondary_name(secondary_name ? copy_string(secondary_name) : nullptr), secondary_name(secondary_name ? copy_string(secondary_name) : nullptr),
type(type), subtype(subtype), optional(optional) { } type(type), subtype(subtype), optional(optional) { }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead")]]
Field(const char* name, const char* secondary_name, ::TypeTag type, ::TypeTag subtype, bool optional) : Field(const char* name, const char* secondary_name, ::TypeTag type, ::TypeTag subtype, bool optional) :
Field(name, secondary_name, static_cast<zeek::TypeTag>(type), static_cast<zeek::TypeTag>(subtype), optional) Field(name, secondary_name, static_cast<zeek::TypeTag>(type), static_cast<zeek::TypeTag>(subtype), optional)
{} {}
#pragma GCC diagnostic pop
/** /**
* Copy constructor. * Copy constructor.
@ -150,10 +153,13 @@ struct Value {
: type(arg_type), subtype(zeek::TYPE_VOID), present(arg_present) : type(arg_type), subtype(zeek::TYPE_VOID), present(arg_present)
{} {}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag.")]]
Value(::TypeTag arg_type, bool arg_present = true) Value(::TypeTag arg_type, bool arg_present = true)
: Value(static_cast<zeek::TypeTag>(arg_type), arg_present) : Value(static_cast<zeek::TypeTag>(arg_type), arg_present)
{} {}
#pragma GCC diagnostic pop
/** /**
* Constructor. * Constructor.
@ -169,10 +175,13 @@ struct Value {
: type(arg_type), subtype(arg_subtype), present(arg_present) : type(arg_type), subtype(arg_subtype), present(arg_present)
{} {}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag.")]] [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag.")]]
Value(::TypeTag arg_type, ::TypeTag arg_subtype, bool arg_present = true) Value(::TypeTag arg_type, ::TypeTag arg_subtype, bool arg_present = true)
: Value(static_cast<zeek::TypeTag>(arg_type), static_cast<zeek::TypeTag>(arg_subtype), arg_present) : Value(static_cast<zeek::TypeTag>(arg_type), static_cast<zeek::TypeTag>(arg_subtype), arg_present)
{} {}
#pragma GCC diagnostic pop
/** /**
* Destructor. * Destructor.