From 61c84a0a406520796dcc0a809a4e02c781641f84 Mon Sep 17 00:00:00 2001 From: Johanna Amann Date: Thu, 2 May 2019 13:02:38 -0700 Subject: [PATCH] Remove synchrnized and persistent attributes. Code that was used by them is still there. --- src/Attr.cc | 2 -- src/Attr.h | 2 -- src/ID.cc | 33 --------------------------------- src/RemoteSerializer.cc | 3 ++- src/StateAccess.cc | 12 ------------ src/Val.h | 7 ++----- src/Var.cc | 20 -------------------- src/parse.y | 5 ----- src/scan.l | 10 ---------- 9 files changed, 4 insertions(+), 90 deletions(-) diff --git a/src/Attr.cc b/src/Attr.cc index d3a347e8d1..3473adcaf3 100644 --- a/src/Attr.cc +++ b/src/Attr.cc @@ -438,8 +438,6 @@ void Attributes::CheckAttr(Attr* a) } break; - case ATTR_PERSISTENT: - case ATTR_SYNCHRONIZED: case ATTR_TRACKED: // FIXME: Check here for global ID? break; diff --git a/src/Attr.h b/src/Attr.h index bfb7c4803c..4a1110bc04 100644 --- a/src/Attr.h +++ b/src/Attr.h @@ -23,8 +23,6 @@ typedef enum { ATTR_EXPIRE_READ, ATTR_EXPIRE_WRITE, ATTR_EXPIRE_CREATE, - ATTR_PERSISTENT, - ATTR_SYNCHRONIZED, ATTR_ENCRYPT, ATTR_RAW_OUTPUT, ATTR_MERGEABLE, diff --git a/src/ID.cc b/src/ID.cc index 0ae1656533..806a7040bc 100644 --- a/src/ID.cc +++ b/src/ID.cc @@ -78,12 +78,6 @@ void ID::SetVal(Val* v, Opcode op, bool arg_weak_ref) MutableVal::Properties props = 0; - if ( attrs && attrs->FindAttr(ATTR_SYNCHRONIZED) ) - props |= MutableVal::SYNCHRONIZED; - - if ( attrs && attrs->FindAttr(ATTR_PERSISTENT) ) - props |= MutableVal::PERSISTENT; - if ( attrs && attrs->FindAttr(ATTR_TRACKED) ) props |= MutableVal::TRACKED; @@ -198,27 +192,12 @@ void ID::UpdateValAttrs() if ( val && val->IsMutableVal() ) { - if ( attrs->FindAttr(ATTR_SYNCHRONIZED) ) - props |= MutableVal::SYNCHRONIZED; - - if ( attrs->FindAttr(ATTR_PERSISTENT) ) - props |= MutableVal::PERSISTENT; - if ( attrs->FindAttr(ATTR_TRACKED) ) props |= MutableVal::TRACKED; val->AsMutableVal()->AddProperties(props); } - if ( ! IsInternalGlobal() ) - { - if ( attrs->FindAttr(ATTR_SYNCHRONIZED) ) - remote_serializer->Register(this); - - if ( attrs->FindAttr(ATTR_PERSISTENT) ) - persistence_serializer->Register(this); - } - if ( val && val->Type()->Tag() == TYPE_TABLE ) val->AsTableVal()->SetAttrs(attrs); @@ -281,12 +260,6 @@ void ID::RemoveAttr(attr_tag a) { MutableVal::Properties props = 0; - if ( a == ATTR_SYNCHRONIZED ) - props |= MutableVal::SYNCHRONIZED; - - if ( a == ATTR_PERSISTENT ) - props |= MutableVal::PERSISTENT; - if ( a == ATTR_TRACKED ) props |= MutableVal::TRACKED; @@ -473,12 +446,6 @@ ID* ID::Unserialize(UnserialInfo* info) } } - if ( id->FindAttr(ATTR_PERSISTENT) ) - persistence_serializer->Register(id); - - if ( id->FindAttr(ATTR_SYNCHRONIZED) ) - remote_serializer->Register(id); - return id; } diff --git a/src/RemoteSerializer.cc b/src/RemoteSerializer.cc index 3abd8e6423..152a8b4e34 100644 --- a/src/RemoteSerializer.cc +++ b/src/RemoteSerializer.cc @@ -2946,7 +2946,8 @@ void RemoteSerializer::GotID(ID* id, Val* val) assert(global_scope()->Lookup(id->Name())); // Only synchronized values can arrive here. - assert(((MutableVal*) val)->GetProperties() & MutableVal::SYNCHRONIZED); + // FIXME: Johanna, rip me out. + // assert(((MutableVal*) val)->GetProperties() & MutableVal::SYNCHRONIZED); DBG_LOG(DBG_COMM, "got ID %s from peer\n", id->Name()); } diff --git a/src/StateAccess.cc b/src/StateAccess.cc index 72ed9ef236..bbf5b3a9ec 100644 --- a/src/StateAccess.cc +++ b/src/StateAccess.cc @@ -876,23 +876,11 @@ void StateAccess::Log(StateAccess* access) if ( access->target_type == TYPE_ID ) { - if ( access->target.id->FindAttr(ATTR_SYNCHRONIZED) ) - synchronized = true; - - if ( access->target.id->FindAttr(ATTR_PERSISTENT) ) - persistent = true; - if ( access->target.id->FindAttr(ATTR_TRACKED) ) tracked = true; } else { - if ( access->target.val->GetProperties() & MutableVal::SYNCHRONIZED ) - synchronized = true; - - if ( access->target.val->GetProperties() & MutableVal::PERSISTENT ) - persistent = true; - if ( access->target.val->GetProperties() & MutableVal::TRACKED ) tracked = true; } diff --git a/src/Val.h b/src/Val.h index 63e790848d..2d915bcc6f 100644 --- a/src/Val.h +++ b/src/Val.h @@ -524,9 +524,6 @@ public: // values. (In any case, don't forget to call the parent's method.) typedef char Properties; - static const int PERSISTENT = 0x01; - static const int SYNCHRONIZED = 0x02; - // Tracked by NotifierRegistry, not recursive. static const int TRACKED = 0x04; @@ -540,10 +537,10 @@ public: bool LoggingAccess() const { #ifndef DEBUG - return props & (SYNCHRONIZED|PERSISTENT|TRACKED); + return props & TRACKED; #else return debug_logger.IsVerbose() || - (props & (SYNCHRONIZED|PERSISTENT|TRACKED)); + (props & TRACKED); #endif } diff --git a/src/Var.cc b/src/Var.cc index fb27b7261f..98651bf900 100644 --- a/src/Var.cc +++ b/src/Var.cc @@ -142,26 +142,6 @@ static void make_var(ID* id, BroType* t, init_class c, Expr* init, } } - if ( id->FindAttr(ATTR_PERSISTENT) || id->FindAttr(ATTR_SYNCHRONIZED) ) - { - if ( dt == VAR_CONST ) - { - id->Error("&persistent/synchronized with constant"); - return; - } - else if ( dt == VAR_OPTION ) - { - id->Error("&persistent/synchronized with option"); - return; - } - - if ( ! id->IsGlobal() ) - { - id->Error("&persistant/synchronized with non-global"); - return; - } - } - if ( do_init ) { if ( c == INIT_NONE && dt == VAR_REDEF && t->IsTable() && diff --git a/src/parse.y b/src/parse.y index 0e363eb321..fb99f14e87 100644 --- a/src/parse.y +++ b/src/parse.y @@ -25,7 +25,6 @@ %token TOK_ATTR_OPTIONAL TOK_ATTR_REDEF TOK_ATTR_ROTATE_INTERVAL %token TOK_ATTR_ROTATE_SIZE TOK_ATTR_DEL_FUNC TOK_ATTR_EXPIRE_FUNC %token TOK_ATTR_EXPIRE_CREATE TOK_ATTR_EXPIRE_READ TOK_ATTR_EXPIRE_WRITE -%token TOK_ATTR_PERSISTENT TOK_ATTR_SYNCHRONIZED %token TOK_ATTR_RAW_OUTPUT TOK_ATTR_MERGEABLE %token TOK_ATTR_PRIORITY TOK_ATTR_LOG TOK_ATTR_ERROR_HANDLER %token TOK_ATTR_TYPE_COLUMN TOK_ATTR_DEPRECATED @@ -1308,10 +1307,6 @@ attr: { $$ = new Attr(ATTR_EXPIRE_READ, $3); } | TOK_ATTR_EXPIRE_WRITE '=' expr { $$ = new Attr(ATTR_EXPIRE_WRITE, $3); } - | TOK_ATTR_PERSISTENT - { $$ = new Attr(ATTR_PERSISTENT); } - | TOK_ATTR_SYNCHRONIZED - { $$ = new Attr(ATTR_SYNCHRONIZED); } | TOK_ATTR_ENCRYPT { $$ = new Attr(ATTR_ENCRYPT); } | TOK_ATTR_ENCRYPT '=' expr diff --git a/src/scan.l b/src/scan.l index fd54cfab40..40ca523daf 100644 --- a/src/scan.l +++ b/src/scan.l @@ -310,11 +310,6 @@ when return TOK_WHEN; return TOK_ATTR_MERGEABLE; } -&persistent { - deprecated_attr(yytext); - return TOK_ATTR_PERSISTENT; - } - &rotate_interval { deprecated_attr(yytext); return TOK_ATTR_ROTATE_INTERVAL; @@ -325,11 +320,6 @@ when return TOK_WHEN; return TOK_ATTR_ROTATE_SIZE; } -&synchronized { - deprecated_attr(yytext); - return TOK_ATTR_SYNCHRONIZED; - } - @deprecated.* { auto num_files = file_stack.length(); auto comment = skip_whitespace(yytext + 11);