[Issue 14417] New: Wrong argument type for _d_cover_register2
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Apr 6 04:44:23 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14417
Issue ID: 14417
Summary: Wrong argument type for _d_cover_register2
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: goejendaagh at zonnet.nl
The function signature is:
extern (C) void _d_cover_register2(string filename, size_t[] valid, uint[]
data, ubyte minPercent)
'valid' should point to a boolean bit-array, where the bit-value indicates
whether the coverage line count is valid for the corresponding source line
number. The rest of the code assumes the slice type to be 'bit[]' (see the
precondition of BitArray::opIndex()), i.e. the slice points to the start of the
bit-array and the slice's length field is equal to the number of valid *bits*
in the array. The current type size_t[] indicates otherwise: the slice pointing
to the start of the bit-array and the length field being equal to the number of
valid size_ts (= valid bits divided by sizeof(size_t)).
This means the _d_cover_register2 function cannot be called from D code without
very ugly slice manipulation.
I see two possibilities of fixing this. I have no preference.
1) Add a new _d_cover_register3 function, with the signature:
extern (C) void _d_cover_register3(string filename, size_t* valid_ptr, size_t
valid_len, uint[] data, ubyte minPercent). Deprecate _d_cover_register2.
2) Accept the current interface of _d_cover_register2, and fix calling code
(e.g. DMD), and fix the precondition of BitArray::opIndex().
I can work on a PR to fix this, but need advice on what course to take.
Thanks,
Johan
--
More information about the Digitalmars-d-bugs
mailing list