Quality of errors in DMD

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 2 11:29:13 PDT 2016


On Fri, Sep 02, 2016 at 08:43:30PM +0300, Dicebot via Digitalmars-d wrote:
> On 09/02/2016 06:45 PM, Wyatt wrote:
> > On the other, though, considering he's been using DMD for years and
> > didn't know that, I think there's a cogent argument for improving
> > even ICE messages.  At the least, have them print "Internal Compiler
> > Error".
> 
> Great idea, I hacked a quick implementation to make all asserts to
> direct to bugzilla: https://github.com/dlang/dmd/pull/6103

Very nice. But currently only works with asserts from D code, whereas
most of the ICE's I found on bugzilla come from C code (backend or glue
layer).

I think it should be possible to "hijack" the C assert() by replacing
all instances of #include <assert.h> with something else that redirects
the call to a custom function, perhaps one that calls the D assert
handler.

(Or, failing that, we can use an IOCCC-style hack of re-#define-ing the
assert macro to something else after the fact. Thankfully the C/C++
assert isn't a keyword, so it's easier to hijack. :-P)

There's also util_assert() in backend/util2.c, which can also be
redirected this way.


T

-- 
WINDOWS = Will Install Needless Data On Whole System -- CompuMan


More information about the Digitalmars-d mailing list