colors in gdc errors

Iain Buclaw ibuclaw at ubuntu.com
Tue Sep 3 09:03:44 PDT 2013


On 3 September 2013 16:54, eles <eles at eles.com> wrote:
> It would be possible to implement this for gdc, too:
>
> http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html#index-fdiagnostics-color-239
>
> ?
> Also, error messages more similar to those spitted out by gcc. Compare:
>
> test01.c:3:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
> ‘int’
>  int main() {
>  ^
>
> with
>
> test01.d:3: Error: no identifier for declarator eroare
> test01.d:3: Error: semicolon expected, not 'int'
>
> that is: also provide column, display the offending line, add a caret on the
> next line.
>
> I know it is not the end of the world, but it would be nice. Did not test
> with ldc...

The front-end would have to track column numbering for to allow use to
use carets in errors.

As for errors, only errors that go through the gcc error system shows
in colours.  So would have to modify the frontend accordingly in that
case...

eg:

void main() { int a = void; }

gdc -fdiagnostics-color -Wunused foo.d

gdc -fdiagnostics-color -Wunused -Werror foo.d


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the D.gnu mailing list