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

@ -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);