Merge remote-tracking branch 'origin/topic/timw/266-namespaces'

Merge adjustments:

- Preserved original `base_type_no_ref` argument type as ::TypeTag
- Removed superfluous #pragma guard around deprecated TableVal ctor
- Clarify NEWS regarding MetaHook{Pre,Post} deprecations
- Simplify some `::zeek::` qualifications to just `zeek::`
- Prefixed FORWARD_DECLARE_NAMESPACED macro with ZEEK_

* origin/topic/timw/266-namespaces:
  Disable some deprecation diagnostics for GCC
  Rename BroType to Type
  Update NEWS
  Review cleanup
  Move Type types to zeek namespace
  Move Flare/Pipe from the bro namespace to zeek::detail
  Move Attr to the zeek::detail namespace
  Move Trigger into the zeek::detail namespace
  Move ID to the zeek::detail namespace
  Move Anon.h into zeek::detail namespace
  Mark all of the aliased classes in plugin/Plugin.h deprecated, and fix all of the plugins that were using them
  Move all of the base plugin classes into the zeek::plugin namespace
  Expr: move all classes into zeek::detail
  Stmt: move Stmt classes into zeek::detail namespace
  Add utility macro for creating namespaced aliases for classes
This commit is contained in:
Jon Siwek 2020-06-11 23:12:02 -07:00
commit d4f3cad7d1
256 changed files with 4277 additions and 3501 deletions

View file

@ -18,14 +18,14 @@
#include "BifReturnVal.h"
class Val;
class ListExpr;
class FuncType;
class Stmt;
class Frame;
class ID;
class CallExpr;
class Scope;
ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(CallExpr, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(FuncType, zeek);
namespace caf {
template <class> class expected;
}
@ -47,10 +47,10 @@ public:
~Func() override;
virtual bool IsPure() const = 0;
function_flavor Flavor() const { return GetType()->Flavor(); }
zeek::FunctionFlavor Flavor() const { return GetType()->Flavor(); }
struct Body {
IntrusivePtr<Stmt> stmts;
IntrusivePtr<zeek::detail::Stmt> stmts;
int priority;
bool operator<(const Body& other) const
{ return priority > other.priority; } // reverse sort
@ -86,17 +86,17 @@ public:
}
// Add a new event handler to an existing function (event).
virtual void AddBody(IntrusivePtr<Stmt> new_body,
const std::vector<IntrusivePtr<ID>>& new_inits,
virtual void AddBody(IntrusivePtr<zeek::detail::Stmt> new_body,
const std::vector<IntrusivePtr<zeek::detail::ID>>& new_inits,
size_t new_frame_size, int priority = 0);
virtual void SetScope(IntrusivePtr<Scope> newscope);
virtual Scope* GetScope() const { return scope.get(); }
[[deprecated("Remove in v4.1. Use GetType().")]]
virtual FuncType* FType() const { return type.get(); }
virtual zeek::FuncType* FType() const { return type.get(); }
const IntrusivePtr<FuncType>& GetType() const
const IntrusivePtr<zeek::FuncType>& GetType() const
{ return type; }
Kind GetKind() const { return kind; }
@ -123,13 +123,13 @@ protected:
// Helper function for checking result of plugin hook.
void CheckPluginResult(bool handled, const IntrusivePtr<Val>& hook_result,
function_flavor flavor) const;
zeek::FunctionFlavor flavor) const;
std::vector<Body> bodies;
IntrusivePtr<Scope> scope;
Kind kind;
uint32_t unique_id;
IntrusivePtr<FuncType> type;
IntrusivePtr<zeek::FuncType> type;
std::string name;
static inline std::vector<IntrusivePtr<Func>> unique_ids;
};
@ -137,8 +137,8 @@ protected:
class BroFunc final : public Func {
public:
BroFunc(const IntrusivePtr<ID>& id, IntrusivePtr<Stmt> body,
const std::vector<IntrusivePtr<ID>>& inits,
BroFunc(const IntrusivePtr<zeek::detail::ID>& id, IntrusivePtr<zeek::detail::Stmt> body,
const std::vector<IntrusivePtr<zeek::detail::ID>>& inits,
size_t frame_size, int priority);
~BroFunc() override;
@ -175,8 +175,8 @@ public:
*/
broker::expected<broker::data> SerializeClosure() const;
void AddBody(IntrusivePtr<Stmt> new_body,
const std::vector<IntrusivePtr<ID>>& new_inits,
void AddBody(IntrusivePtr<zeek::detail::Stmt> new_body,
const std::vector<IntrusivePtr<zeek::detail::ID>>& new_inits,
size_t new_frame_size, int priority) override;
/** Sets this function's outer_id list. */
@ -187,8 +187,9 @@ public:
protected:
BroFunc() : Func(BRO_FUNC) {}
IntrusivePtr<Stmt> AddInits(IntrusivePtr<Stmt> body,
const std::vector<IntrusivePtr<ID>>& inits);
IntrusivePtr<zeek::detail::Stmt> AddInits(
IntrusivePtr<zeek::detail::Stmt> body,
const std::vector<IntrusivePtr<zeek::detail::ID>>& inits);
/**
* Clones this function along with its closures.
@ -240,10 +241,10 @@ extern void builtin_error(const char* msg, BroObj* arg);
extern void init_builtin_funcs();
extern void init_builtin_funcs_subdirs();
extern bool check_built_in_call(BuiltinFunc* f, CallExpr* call);
extern bool check_built_in_call(BuiltinFunc* f, zeek::detail::CallExpr* call);
struct CallInfo {
const CallExpr* call;
const zeek::detail::CallExpr* call;
const Func* func;
const zeek::Args& args;
};
@ -254,11 +255,11 @@ struct function_ingredients {
// Gathers all of the information from a scope and a function body needed
// to build a function.
function_ingredients(IntrusivePtr<Scope> scope, IntrusivePtr<Stmt> body);
function_ingredients(IntrusivePtr<Scope> scope, IntrusivePtr<zeek::detail::Stmt> body);
IntrusivePtr<ID> id;
IntrusivePtr<Stmt> body;
std::vector<IntrusivePtr<ID>> inits;
IntrusivePtr<zeek::detail::ID> id;
IntrusivePtr<zeek::detail::Stmt> body;
std::vector<IntrusivePtr<zeek::detail::ID>> inits;
int frame_size;
int priority;
IntrusivePtr<Scope> scope;