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);
}
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)
: Attr(t, nullptr)
#pragma GCC diagnostic push
#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))
{
}
#pragma GCC diagnostic pop
Attr::~Attr() = default;
@ -243,11 +246,6 @@ const IntrusivePtr<Attr>& Attributes::Find(attr_tag t) const
return Attr::nil;
}
Attr* Attributes::FindAttr(::attr_tag t) const
{
return FindAttr(static_cast<attr_tag>(t));
}
void Attributes::RemoveAttr(attr_tag t)
{
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)
{
RemoveAttr(static_cast<attr_tag>(t));
}
#pragma GCC diagnostic pop
void Attributes::Describe(ODesc* d) const
{

View file

@ -65,12 +65,16 @@ public:
static inline const IntrusivePtr<zeek::detail::Attr> nil;
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.")]]
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.")]]
explicit Attr(::attr_tag t);
#pragma GCC diagnostic pop
~Attr() override;
@ -127,14 +131,18 @@ public:
[[deprecated("Remove in v4.1. Use Find().")]]
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;
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.")]]
void RemoveAttr(::attr_tag t);
#pragma GCC diagnostic pop
void Describe(ODesc* d) const override;
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);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
ID::ID(const char* arg_name, ::IDScope arg_scope, bool arg_is_export) :
ID(arg_name, static_cast<IDScope>(arg_scope), arg_is_export) {}
#pragma GCC diagnostic pop
ID::~ID()
{
@ -220,6 +223,8 @@ void ID::SetVal(IntrusivePtr<Expr> ev, init_class c)
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)
{
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));
}
#pragma GCC diagnostic pop
bool ID::IsRedefinable() const
{
@ -337,10 +343,13 @@ void ID::RemoveAttr(attr_tag a)
attrs->RemoveAttr(a);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void ID::RemoveAttr(::attr_tag a)
{
RemoveAttr(static_cast<attr_tag>(a));
}
#pragma GCC diagnostic pop
void ID::SetOption()
{

View file

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

View file

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

View file

@ -7,47 +7,47 @@
#include "Stats.h"
[[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.")]]
extern RecordType* endpoint;
extern zeek::RecordType* endpoint;
[[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.")]]
extern RecordType* connection_type;
extern zeek::RecordType* connection_type;
[[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.")]]
extern RecordType* fa_metadata_type;
extern zeek::RecordType* fa_metadata_type;
[[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.")]]
extern RecordType* icmp_context;
extern zeek::RecordType* icmp_context;
[[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.")]]
extern RecordType* SYN_packet;
extern zeek::RecordType* SYN_packet;
[[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.")]]
extern RecordType* raw_pkt_hdr_type;
extern zeek::RecordType* raw_pkt_hdr_type;
[[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.")]]
extern EnumType* transport_proto;
extern zeek::EnumType* transport_proto;
[[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.")]]
extern TableType* string_array;
extern zeek::TableType* string_array;
[[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.")]]
extern VectorType* string_vec;
extern zeek::VectorType* string_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.")]]
extern VectorType* mime_matches;
extern zeek::VectorType* mime_matches;
[[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern RecordType* mime_match;
extern zeek::RecordType* mime_match;
extern int watchdog_interval;
@ -76,7 +76,7 @@ extern int tcp_excessive_data_without_further_acks;
extern int tcp_max_old_segments;
[[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 tcp_inactivity_timeout;
@ -114,50 +114,50 @@ extern double rpc_timeout;
extern int mime_segment_length;
extern int mime_segment_overlap_length;
[[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.")]]
extern TableType* mime_header_list;
extern zeek::TableType* mime_header_list;
extern int http_entity_data_delivery_size;
[[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.")]]
extern RecordType* http_message_stat;
extern zeek::RecordType* http_message_stat;
extern int truncate_http_URI;
[[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.")]]
extern TableType* pm_mappings;
extern zeek::TableType* pm_mappings;
[[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.")]]
extern RecordType* pm_callit_request;
extern zeek::RecordType* pm_callit_request;
[[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.")]]
extern RecordType* entropy_test_result;
extern zeek::RecordType* entropy_test_result;
[[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.")]]
extern RecordType* dns_answer;
extern zeek::RecordType* dns_answer;
[[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.")]]
extern RecordType* dns_edns_additional;
extern zeek::RecordType* dns_edns_additional;
[[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.")]]
extern RecordType* dns_rrsig_rr;
extern zeek::RecordType* dns_rrsig_rr;
[[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.")]]
extern RecordType* dns_nsec3_rr;
extern zeek::RecordType* dns_nsec3_rr;
[[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.")]]
extern TableVal* dns_skip_auth;
[[deprecated("Remove in v4.1. Perform your own lookup.")]]
@ -187,7 +187,7 @@ extern TableVal* preserve_other_addr;
extern double connection_status_update_interval;
[[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.")]]
extern StringVal* log_rotate_base_time;
@ -212,9 +212,9 @@ extern int packet_filter_default;
extern int sig_max_group_size;
[[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.")]]
extern RecordType* irc_join_info;
extern zeek::RecordType* irc_join_info;
extern int dpd_reassemble_first_packets;
extern int dpd_buffer_size;
@ -235,17 +235,17 @@ extern StringVal* trace_output_file;
extern int record_all_packets;
[[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.")]]
extern TableType* id_table;
extern zeek::TableType* id_table;
[[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.")]]
extern TableType* record_field_table;
extern zeek::TableType* record_field_table;
[[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.")]]
extern VectorType* call_argument_vector;
extern zeek::VectorType* call_argument_vector;
[[deprecated("Remove in v4.1. Perform your own lookup.")]]
extern StringVal* cmd_line_bpf_filter;

View file

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

View file

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

View file

@ -236,10 +236,13 @@ public:
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.")]]
SetIterator(RecordVal* v, ::TypeTag tag, Frame* f)
: SetIterator(v, static_cast<zeek::TypeTag>(tag), f)
{}
#pragma GCC diagnostic pop
broker::set dat;
broker::set::iterator it;
@ -261,10 +264,13 @@ public:
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.")]]
TableIterator(RecordVal* v, ::TypeTag tag, Frame* f)
: TableIterator(v, static_cast<zeek::TypeTag>(tag), f)
{}
#pragma GCC diagnostic pop
broker::table dat;
broker::table::iterator it;
@ -286,10 +292,13 @@ public:
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.")]]
VectorIterator(RecordVal* v, ::TypeTag tag, Frame* f)
: VectorIterator(v, static_cast<zeek::TypeTag>(tag), f)
{}
#pragma GCC diagnostic pop
broker::vector dat;
broker::vector::iterator it;
@ -311,10 +320,13 @@ public:
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.")]]
RecordIterator(RecordVal* v, ::TypeTag tag, Frame* f)
: RecordIterator(v, static_cast<zeek::TypeTag>(tag), f)
{}
#pragma GCC diagnostic pop
broker::vector dat;
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, 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.")]]
FieldMapping(const std::string& arg_name, const ::TypeTag& arg_type, int 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(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() { 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)
: plugin::Component(static_cast<zeek::plugin::component::Type>(type), name)
{
}
#pragma GCC diagnostic pop
Component::~Component()
{

View file

@ -53,8 +53,11 @@ protected:
* @param name A descriptive name for the component. This name must
* 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")]]
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);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Component::Component(::plugin::component::Type arg_type, const std::string& arg_name)
{
type = static_cast<component::Type>(arg_type);
name = arg_name;
canon_name = canonify_name(name);
}
#pragma GCC diagnostic pop
Component::~Component()
{

View file

@ -65,8 +65,11 @@ public:
* @param name A descriptive name for the component. This name must
* 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")]]
Component(::plugin::component::Type type, const std::string& name);
#pragma GCC diagnostic pop
/**
* Destructor.

View file

@ -530,11 +530,6 @@ std::list<std::pair<::zeek::plugin::HookType, int> > Manager::HooksEnabledForPlu
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)
{
if ( ! hooks[hook] )
@ -553,11 +548,6 @@ void Manager::EnableHook(zeek::plugin::HookType hook, Plugin* plugin, int prio)
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)
{
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)
{
DBG_LOG(DBG_PLUGINS, "Plugin %s requested event %s",

View file

@ -171,12 +171,15 @@ public:
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")]]
bool HavePluginForHook(::plugin::HookType hook) const
{
// Inline to avoid the function call.
return HavePluginForHook(static_cast<zeek::plugin::HookType>(hook));
}
#pragma GCC diagnostic pop
/**
* 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.
*/
[[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);
/**
@ -206,9 +207,16 @@ public:
*
* 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")]]
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

View file

@ -42,10 +42,13 @@ static constexpr const char* hook_names[int(::zeek::plugin::NUM_HOOKS) + 1] = {
return hook_names[int(h)];
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
const char* plugin::hook_name(::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)
{
@ -355,20 +358,23 @@ Plugin::hook_list Plugin::EnabledHooks() const
return plugin_mgr->HooksEnabledForPlugin(this);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void Plugin::EnableHook(::plugin::HookType hook, int 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)
{
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)
{
@ -461,6 +467,8 @@ bool Plugin::HookReporter(const std::string& prefix, const EventHandlerPtr event
return true;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
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)
{
}
#pragma GCC diagnostic pop
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.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
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
* 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);
/**
@ -625,9 +626,16 @@ protected:
*
* @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.")]]
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,
@ -880,9 +888,12 @@ protected:
*
* 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.")]]
virtual void MetaHookPre(::plugin::HookType hook, const HookArgumentList& args);
#pragma GCC diagnostic pop
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
* 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.")]]
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);
private:

View file

@ -33,10 +33,13 @@ struct Field {
secondary_name(secondary_name ? copy_string(secondary_name) : nullptr),
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")]]
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)
{}
#pragma GCC diagnostic pop
/**
* Copy constructor.
@ -150,10 +153,13 @@ struct Value {
: 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.")]]
Value(::TypeTag arg_type, bool arg_present = true)
: Value(static_cast<zeek::TypeTag>(arg_type), arg_present)
{}
#pragma GCC diagnostic pop
/**
* Constructor.
@ -169,10 +175,13 @@ struct Value {
: 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.")]]
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)
{}
#pragma GCC diagnostic pop
/**
* Destructor.