bugs-code.xreate
No OneTemporary

File Metadata

Created
Fri, Mar 13, 11:04 PM

bugs-code.xreate

//unsafe code propagation rule
rule: (X: function, Y: function)
case X call Y, -X tag suppress(unsafe_propagation_warning)
{
warning Y tag unsafe -> X tag unsafe
message "safe function should not call unsafe code"
}
//bugs propagation rule
rule: (X: function, Y: function)
case X call Y, - X tag suppress(bugs_propagation_warnings)
{
warning Y tag bug(no(No)) -> X tag bug(no(No))
message "Function should declare bugs it aware of"
}
testfunc3 = function: (a: num, b: num)->num,unsafe, bug(no(1273)) //function tags list
{
x = a+b: num;
y = a - b: num;
(x + y) / 2;
}
testfunc2 = function: (a: num)->bool // because of testfunc3 marked as unsafe code,
// testfunc2 should be marked so too
,suppress(bugs_propagation_warnings), suppress(unsafe_propagation_warning)
{
b = testfunc3(a+1, a-1): num;
(b==0);
}

Event Timeline