&is_set => &is_assigned

This commit is contained in:
Vern Paxson 2021-02-04 12:18:46 -08:00
parent d71675a7dc
commit c991c54690
16 changed files with 22 additions and 22 deletions

View file

@ -240,7 +240,7 @@ function set_conn(c: connection, eoc: bool)
{ {
if ( ! c?$conn ) if ( ! c?$conn )
{ {
local tmp: Info &is_set; local tmp: Info &is_assigned;
c$conn = tmp; c$conn = tmp;
} }

View file

@ -293,7 +293,7 @@ hook set_session(c: connection, msg: dns_msg, is_query: bool) &priority=5
else else
{ {
# Just pick an arbitrary, unpaired query. # Just pick an arbitrary, unpaired query.
local tid: count &is_set; local tid: count &is_assigned;
local found_one = F; local found_one = F;
for ( trans_id, q in c$dns_state$pending_queries ) for ( trans_id, q in c$dns_state$pending_queries )

View file

@ -87,7 +87,7 @@ function add_pending_cmd(pc: PendingCmds, cmd: string, arg: string): CmdArg
# response code and message. # response code and message.
function get_pending_cmd(pc: PendingCmds, reply_code: count, reply_msg: string): CmdArg function get_pending_cmd(pc: PendingCmds, reply_code: count, reply_msg: string): CmdArg
{ {
local best_match: CmdArg &is_set; # &is_set for $ts field local best_match: CmdArg &is_assigned; # &is_assigned for $ts field
local best_seq = 0; local best_seq = 0;
local best_score: int = -1; local best_score: int = -1;

View file

@ -66,7 +66,7 @@ event zeek_init() &priority=5
event ntp_message(c: connection, is_orig: bool, msg: NTP::Message) &priority=5 event ntp_message(c: connection, is_orig: bool, msg: NTP::Message) &priority=5
{ {
local info: Info &is_set; # &is_set for case where no $std_msg local info: Info &is_assigned; # for case where no $std_msg
info$ts = network_time(); info$ts = network_time();
info$uid = c$uid; info$uid = c$uid;
info$id = c$id; info$id = c$id;

View file

@ -142,7 +142,7 @@ function set_session(c: connection)
{ {
if ( ! c?$ssh ) if ( ! c?$ssh )
{ {
local info: SSH::Info &is_set; # needed for $version local info: SSH::Info &is_assigned; # needed for $version
info$ts = network_time(); info$ts = network_time();
info$uid = c$uid; info$uid = c$uid;
info$id = c$id; info$id = c$id;

View file

@ -102,7 +102,7 @@ event file_sniff(f: fa_file, meta: fa_metadata) &priority=5
|| f$info$mime_type == "application/pkix-cert" ) ) || f$info$mime_type == "application/pkix-cert" ) )
return; return;
local c: connection &is_set; # &is_set to help static analysis local c: connection &is_assigned; # to help static analysis
for ( cid, c in f$conns ) for ( cid, c in f$conns )
{ {

View file

@ -44,7 +44,7 @@ event file_sniff(f: fa_file, meta: fa_metadata) &priority=4
|| f$info$mime_type == "application/pkix-cert" ) ) || f$info$mime_type == "application/pkix-cert" ) )
return; return;
local c: connection &is_set; local c: connection &is_assigned;
for ( cid, c in f$conns ) for ( cid, c in f$conns )
{ {

View file

@ -95,7 +95,7 @@ event x509_ocsp_ext_signed_certificate_timestamp(f: fa_file, version: count, log
if ( |f$conns| != 1 ) if ( |f$conns| != 1 )
return; return;
local c: connection &is_set; local c: connection &is_assigned;
for ( cid, c in f$conns ) for ( cid, c in f$conns )
{ {

View file

@ -290,7 +290,7 @@ void Attributes::CheckAttr(Attr* a)
switch ( a->Tag() ) { switch ( a->Tag() ) {
case ATTR_DEPRECATED: case ATTR_DEPRECATED:
case ATTR_REDEF: case ATTR_REDEF:
case ATTR_IS_SET: case ATTR_IS_ASSIGNED:
break; break;
case ATTR_OPTIONAL: case ATTR_OPTIONAL:

View file

@ -46,7 +46,7 @@ enum AttrTag {
ATTR_BROKER_STORE_ALLOW_COMPLEX, // for Broker store backed tables ATTR_BROKER_STORE_ALLOW_COMPLEX, // for Broker store backed tables
ATTR_BACKEND, // for Broker store backed tables ATTR_BACKEND, // for Broker store backed tables
ATTR_DEPRECATED, ATTR_DEPRECATED,
ATTR_IS_SET, // to suppress warnings ATTR_IS_ASSIGNED, // to suppress warnings
NUM_ATTRS // this item should always be last NUM_ATTRS // this item should always be last
}; };

View file

@ -28,7 +28,7 @@
%token TOK_ATTR_BROKER_STORE_ALLOW_COMPLEX TOK_ATTR_BACKEND %token TOK_ATTR_BROKER_STORE_ALLOW_COMPLEX TOK_ATTR_BACKEND
%token TOK_ATTR_PRIORITY TOK_ATTR_LOG TOK_ATTR_ERROR_HANDLER %token TOK_ATTR_PRIORITY TOK_ATTR_LOG TOK_ATTR_ERROR_HANDLER
%token TOK_ATTR_TYPE_COLUMN TOK_ATTR_DEPRECATED %token TOK_ATTR_TYPE_COLUMN TOK_ATTR_DEPRECATED
%token TOK_ATTR_IS_SET %token TOK_ATTR_IS_ASSIGNED
%token TOK_DEBUG %token TOK_DEBUG
@ -1472,8 +1472,8 @@ attr:
{ $$ = new zeek::detail::Attr(zeek::detail::ATTR_OPTIONAL); } { $$ = new zeek::detail::Attr(zeek::detail::ATTR_OPTIONAL); }
| TOK_ATTR_REDEF | TOK_ATTR_REDEF
{ $$ = new zeek::detail::Attr(zeek::detail::ATTR_REDEF); } { $$ = new zeek::detail::Attr(zeek::detail::ATTR_REDEF); }
| TOK_ATTR_IS_SET | TOK_ATTR_IS_ASSIGNED
{ $$ = new zeek::detail::Attr(zeek::detail::ATTR_IS_SET); } { $$ = new zeek::detail::Attr(zeek::detail::ATTR_IS_ASSIGNED); }
| TOK_ATTR_ADD_FUNC '=' expr | TOK_ATTR_ADD_FUNC '=' expr
{ $$ = new zeek::detail::Attr(zeek::detail::ATTR_ADD_FUNC, {zeek::AdoptRef{}, $3}); } { $$ = new zeek::detail::Attr(zeek::detail::ATTR_ADD_FUNC, {zeek::AdoptRef{}, $3}); }
| TOK_ATTR_DEL_FUNC '=' expr | TOK_ATTR_DEL_FUNC '=' expr

View file

@ -285,7 +285,7 @@ when return TOK_WHEN;
&expire_func return TOK_ATTR_EXPIRE_FUNC; &expire_func return TOK_ATTR_EXPIRE_FUNC;
&log return TOK_ATTR_LOG; &log return TOK_ATTR_LOG;
&optional return TOK_ATTR_OPTIONAL; &optional return TOK_ATTR_OPTIONAL;
&is_set return TOK_ATTR_IS_SET; &is_assigned return TOK_ATTR_IS_ASSIGNED;
&priority return TOK_ATTR_PRIORITY; &priority return TOK_ATTR_PRIORITY;
&type_column return TOK_ATTR_TYPE_COLUMN; &type_column return TOK_ATTR_TYPE_COLUMN;
&read_expire return TOK_ATTR_EXPIRE_READ; &read_expire return TOK_ATTR_EXPIRE_READ;

View file

@ -733,7 +733,7 @@ void RD_Decorate::CheckVar(const Expr* e, const ID* id, bool check_fields)
return; return;
if ( analysis_options.usage_issues > 0 && if ( analysis_options.usage_issues > 0 &&
! mgr.HasPreMinRD(e, id) && ! id->GetAttr(ATTR_IS_SET) ) ! mgr.HasPreMinRD(e, id) && ! id->GetAttr(ATTR_IS_ASSIGNED) )
e->Warn("possibly used without definition"); e->Warn("possibly used without definition");
if ( check_fields && id->GetType()->Tag() == TYPE_RECORD ) if ( check_fields && id->GetType()->Tag() == TYPE_RECORD )
@ -921,7 +921,7 @@ TraversalCode RD_Decorate::PreExpr(const Expr* e)
{ {
auto r_def = mgr.GetExprDI(r); auto r_def = mgr.GetExprDI(r);
if ( r_def && ! r_def->RootID()->GetAttr(ATTR_IS_SET) ) if ( r_def && ! r_def->RootID()->GetAttr(ATTR_IS_ASSIGNED) )
{ {
auto fn = f->FieldName(); auto fn = f->FieldName();
auto field_rd = mgr.GetConstID_DI(r_def.get(), fn); auto field_rd = mgr.GetConstID_DI(r_def.get(), fn);
@ -1243,7 +1243,7 @@ void RD_Decorate::CheckRecordRDs(std::shared_ptr<DefinitionItem> di,
CreateRecordRDs(di, dp, false, nullptr); CreateRecordRDs(di, dp, false, nullptr);
auto root_id = di->RootID(); auto root_id = di->RootID();
if ( root_id->GetAttr(ATTR_IS_SET) ) if ( root_id->GetAttr(ATTR_IS_ASSIGNED) )
// No point checking for unset fields. // No point checking for unset fields.
return; return;
@ -1254,7 +1254,7 @@ void RD_Decorate::CheckRecordRDs(std::shared_ptr<DefinitionItem> di,
{ {
if ( rt->FieldHasAttr(i, ATTR_DEFAULT) || if ( rt->FieldHasAttr(i, ATTR_DEFAULT) ||
rt->FieldHasAttr(i, ATTR_OPTIONAL) || rt->FieldHasAttr(i, ATTR_OPTIONAL) ||
rt->FieldHasAttr(i, ATTR_IS_SET) ) rt->FieldHasAttr(i, ATTR_IS_ASSIGNED) )
continue; continue;
auto n_i = rt->FieldName(i); auto n_i = rt->FieldName(i);

View file

@ -5,12 +5,12 @@ type r: record {
a: count; a: count;
b: count &optional; b: count &optional;
c: count &default = 9; c: count &default = 9;
d: string &is_set; d: string &is_assigned;
e: string; e: string;
}; };
type r2: record { type r2: record {
no_worries: r &is_set; no_worries: r &is_assigned;
worries: r; worries: r;
}; };

View file

@ -37,7 +37,7 @@ event x509_ocsp_ext_signed_certificate_timestamp(f: fa_file, version: count, log
if ( ! f$conns[cid]?$ssl ) if ( ! f$conns[cid]?$ssl )
return; return;
local c: connection &is_set; local c: connection &is_assigned;
c = f$conns[cid]; c = f$conns[cid];
} }

View file

@ -20,7 +20,7 @@ event x509_ocsp_ext_signed_certificate_timestamp(f: fa_file, version: count, log
if ( ! f$conns[cid]?$ssl ) if ( ! f$conns[cid]?$ssl )
return; return;
local c: connection &is_set; local c: connection &is_assigned;
c = f$conns[cid]; c = f$conns[cid];
} }