[
https://bro-tracker.atlassian.net/browse/BIT-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18900#comment-18900
]
Jon Siwek commented on BIT-1288:
--------------------------------
There's maybe two parts to this:
1) Improve the type coercion that &default attributes use. E.g. this may be
enough:
{noformat}
diff --git a/src/Attr.cc b/src/Attr.cc
index d6d0f6e..3f86238 100644
--- a/src/Attr.cc
+++ b/src/Attr.cc
@@ -265,6 +265,11 @@ void Attributes::CheckAttr(Attr* a)
// Ok.
break;
+ Expr* e = a->AttrExpr();
+ if ( check_and_promote_expr(e, type) )
+ // Ok.
+ break;
+
a->AttrExpr()->Error("&default value has inconsistent
type", type);
}
{noformat}
2) I don't think &default currently means anything when applied to variables as
the test example shows. Was that just a short way to get the parser to create
some type declarations and show the error message, or can you give more context
on how you're trying to use this? Wouldn't assigning a value directly be
conceptually the same as &default here?
> int: &default value has inconsistent type (0 and int)
> -----------------------------------------------------
>
> Key: BIT-1288
> URL: https://bro-tracker.atlassian.net/browse/BIT-1288
> Project: Bro Issue Tracker
> Issue Type: Problem
> Components: Bro
> Affects Versions: git/master
> Environment: Debian 7
> Reporter: Christian Struck
> Labels: language
> Fix For: 2.4
>
> Attachments: test.bro
>
>
> It seems that default >=0 for integer are not interpreted as int and
> therefore not assignable. for the zero value -0 works, but for -1 is not 1.
--
This message was sent by Atlassian JIRA
(v6.4-OD-09-008#64005)
_______________________________________________
bro-dev mailing list
[email protected]
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev