From 149e3b3c324677afcd9e1e48b312e3d2b9fde0e6 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 11 Jun 2020 15:43:11 -0700 Subject: [PATCH] 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. --- src/Attr.cc | 22 ++++--- src/Attr.h | 14 ++++- src/ID.cc | 9 +++ src/ID.h | 12 ++++ src/NetVar.cc | 100 ++++++++++++++++---------------- src/NetVar.h | 100 ++++++++++++++++---------------- src/Type.h | 19 +++++- src/Val.h | 19 +++++- src/broker/Data.h | 12 ++++ src/input/readers/ascii/Ascii.h | 3 + src/iosource/Component.cc | 3 + src/iosource/Component.h | 3 + src/plugin/Component.cc | 3 + src/plugin/Component.h | 3 + src/plugin/Manager.cc | 23 ++++---- src/plugin/Manager.h | 14 ++++- src/plugin/Plugin.cc | 19 ++++-- src/plugin/Plugin.h | 23 ++++++-- src/threading/SerialTypes.h | 9 +++ 19 files changed, 275 insertions(+), 135 deletions(-) diff --git a/src/Attr.cc b/src/Attr.cc index dea614748c..859ddaa720 100644 --- a/src/Attr.cc +++ b/src/Attr.cc @@ -32,18 +32,21 @@ Attr::Attr(attr_tag t, IntrusivePtr e) SetLocationInfo(&start_location, &end_location); } -Attr::Attr(::attr_tag t, IntrusivePtr e) : Attr(static_cast(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 e) : Attr(static_cast(t), e) { } Attr::Attr(::attr_tag t) : Attr(static_cast(t)) { } +#pragma GCC diagnostic pop Attr::~Attr() = default; @@ -243,11 +246,6 @@ const IntrusivePtr& Attributes::Find(attr_tag t) const return Attr::nil; } -Attr* Attributes::FindAttr(::attr_tag t) const - { - return FindAttr(static_cast(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(t)); + } + void Attributes::RemoveAttr(::attr_tag t) { RemoveAttr(static_cast(t)); } +#pragma GCC diagnostic pop void Attributes::Describe(ODesc* d) const { diff --git a/src/Attr.h b/src/Attr.h index f51bb471a8..eba2594e91 100644 --- a/src/Attr.h +++ b/src/Attr.h @@ -65,12 +65,16 @@ public: static inline const IntrusivePtr nil; Attr(attr_tag t, IntrusivePtr 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 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& 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; diff --git a/src/ID.cc b/src/ID.cc index 0c4fcad122..3d6bcab64c 100644 --- a/src/ID.cc +++ b/src/ID.cc @@ -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(arg_scope), arg_is_export) {} +#pragma GCC diagnostic pop ID::~ID() { @@ -220,6 +223,8 @@ void ID::SetVal(IntrusivePtr ev, init_class c) EvalFunc(a->GetExpr(), std::move(ev)); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" void ID::SetVal(IntrusivePtr v, ::init_class c) { SetVal(v, static_cast(c)); @@ -229,6 +234,7 @@ void ID::SetVal(IntrusivePtr ev, ::init_class c) { SetVal(ev, static_cast(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(a)); } +#pragma GCC diagnostic pop void ID::SetOption() { diff --git a/src/ID.h b/src/ID.h index 35b354aa6e..01226cc999 100644 --- a/src/ID.h +++ b/src/ID.h @@ -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 v, init_class c); void SetVal(IntrusivePtr 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 v, ::init_class c); [[deprecated("Remove in v4.1. Use version that takes zeek::detail::init_class")]] void SetVal(IntrusivePtr ev, ::init_class c); +#pragma GCC diagnostic pop bool HasVal() const { return val != nullptr; } @@ -119,8 +125,11 @@ public: void SetAttrs(IntrusivePtr attr); void AddAttrs(IntrusivePtr 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& 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(t)).get(); } +#pragma GCC diagnostic pop const IntrusivePtr& GetAttr(zeek::detail::attr_tag t) const; diff --git a/src/NetVar.cc b/src/NetVar.cc index 535350b4eb..27a8f98340 100644 --- a/src/NetVar.cc +++ b/src/NetVar.cc @@ -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; diff --git a/src/NetVar.h b/src/NetVar.h index ac616d03a9..86116228af 100644 --- a/src/NetVar.h +++ b/src/NetVar.h @@ -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; diff --git a/src/Type.h b/src/Type.h index c56e5a037b..75a62e2f7b 100644 --- a/src/Type.h +++ b/src/Type.h @@ -190,10 +190,14 @@ public: static inline const IntrusivePtr 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(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 args, IntrusivePtr 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 args, IntrusivePtr yield, ::function_flavor f) : FuncType(args, yield, static_cast(f)) {} +#pragma GCC diagnostic pop IntrusivePtr 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(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(a)).get() : nullptr; } +#pragma GCC diagnostic pop const IntrusivePtr& 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(at)); } +#pragma GCC diagnostic pop std::string GetFieldDeprecationWarning(int field, bool has_check) const; @@ -984,7 +1001,7 @@ inline const IntrusivePtr& 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(tag)).get(); } extern IntrusivePtr md5_type; diff --git a/src/Val.h b/src/Val.h index 599cff20c3..ddd4480311 100644 --- a/src/Val.h +++ b/src/Val.h @@ -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(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(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 t, IntrusivePtr 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 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(t)).get(); } +#pragma GCC diagnostic pop const IntrusivePtr& 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 new_val); bool CheckAndAssign(IntrusivePtr index, IntrusivePtr new_val); diff --git a/src/broker/Data.h b/src/broker/Data.h index b467576810..8045c86b28 100644 --- a/src/broker/Data.h +++ b/src/broker/Data.h @@ -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(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(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(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(tag), f) {} +#pragma GCC diagnostic pop broker::vector dat; broker::vector::iterator it; diff --git a/src/input/readers/ascii/Ascii.h b/src/input/readers/ascii/Ascii.h index 2c958bf2f1..3f7b04808b 100644 --- a/src/input/readers/ascii/Ascii.h +++ b/src/input/readers/ascii/Ascii.h @@ -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(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(arg_type), static_cast(arg_subtype), arg_position) {} +#pragma GCC diagnostic pop FieldMapping(const FieldMapping& arg); FieldMapping() { position = -1; secondary_position = -1; } diff --git a/src/iosource/Component.cc b/src/iosource/Component.cc index c49ec79464..b4cd06ce2f 100644 --- a/src/iosource/Component.cc +++ b/src/iosource/Component.cc @@ -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(type), name) { } +#pragma GCC diagnostic pop Component::~Component() { diff --git a/src/iosource/Component.h b/src/iosource/Component.h index e3e58b9350..878d202ac9 100644 --- a/src/iosource/Component.h +++ b/src/iosource/Component.h @@ -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 }; /** diff --git a/src/plugin/Component.cc b/src/plugin/Component.cc index a37ddca037..4154cf2add 100644 --- a/src/plugin/Component.cc +++ b/src/plugin/Component.cc @@ -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(arg_type); name = arg_name; canon_name = canonify_name(name); } +#pragma GCC diagnostic pop Component::~Component() { diff --git a/src/plugin/Component.h b/src/plugin/Component.h index b71f20b39b..fd88d8485c 100644 --- a/src/plugin/Component.h +++ b/src/plugin/Component.h @@ -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. diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index 86fd7be70b..ae6609ebe6 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -530,11 +530,6 @@ std::list > Manager::HooksEnabledForPlu return enabled; } -void Manager::EnableHook(::plugin::HookType hook, Plugin* plugin, int prio) - { - EnableHook(static_cast(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(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(hook), plugin, prio); + } + +void Manager::DisableHook(::plugin::HookType hook, Plugin* plugin) + { + DisableHook(static_cast(hook), plugin); + } +#pragma GCC diagnostic pop + void Manager::RequestEvent(EventHandlerPtr handler, Plugin* plugin) { DBG_LOG(DBG_PLUGINS, "Plugin %s requested event %s", diff --git a/src/plugin/Manager.h b/src/plugin/Manager.h index 2c983b7f31..2a8e4db469 100644 --- a/src/plugin/Manager.h +++ b/src/plugin/Manager.h @@ -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(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 diff --git a/src/plugin/Plugin.cc b/src/plugin/Plugin.cc index 77b98c9760..391c56ea65 100644 --- a/src/plugin/Plugin.cc +++ b/src/plugin/Plugin.cc @@ -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(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(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) { diff --git a/src/plugin/Plugin.h b/src/plugin/Plugin.h index 6854c5d321..be3a78fdbc 100644 --- a/src/plugin/Plugin.h +++ b/src/plugin/Plugin.h @@ -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: diff --git a/src/threading/SerialTypes.h b/src/threading/SerialTypes.h index 1fc816c2f9..a78af7ce4a 100644 --- a/src/threading/SerialTypes.h +++ b/src/threading/SerialTypes.h @@ -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(type), static_cast(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(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(arg_type), static_cast(arg_subtype), arg_present) {} +#pragma GCC diagnostic pop /** * Destructor.