www.digitalmars.com         C & C++   DMDScript  

D.gnu - colors in gdc errors

reply "eles" <eles eles.com> writes:
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...
Sep 03 2013
next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 3 September 2013 16:54, eles <eles eles.com> wrote:
 It would be possible to implement this for gdc, too:

 http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html#index=

 ?
 Also, error messages more similar to those spitted out by gcc. Compare:

 test01.c:3:1: error: expected =91=3D=92, =91,=92, =91;=92, =91asm=92 or =

 =91int=92
  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 =

 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 =3D void; } gdc -fdiagnostics-color -Wunused foo.d gdc -fdiagnostics-color -Wunused -Werror foo.d Regards --=20 Iain Buclaw *(p < e ? p++ : p) =3D (c & 0x0f) + '0';
Sep 03 2013
prev sibling next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 3 September 2013 17:03, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 On 3 September 2013 16:54, eles <eles eles.com> wrote:
 It would be possible to implement this for gdc, too:

 http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html#inde=


 ?
 Also, error messages more similar to those spitted out by gcc. Compare:

 test01.c:3:1: error: expected =91=3D=92, =91,=92, =91;=92, =91asm=92 or =


 =91int=92
  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=


 next line.

 I know it is not the end of the world, but it would be nice. Did not tes=


 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...

https://github.com/D-Programming-GDC/GDC/commit/b2a4421180f70475b52497a75ab= 0fe760ebc82d7 --=20 Iain Buclaw *(p < e ? p++ : p) =3D (c & 0x0f) + '0';
Sep 30 2013
prev sibling next sibling parent "eles" <eles eles.com> writes:
On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw wrote:
 On 3 September 2013 17:03, Iain Buclaw <ibuclaw ubuntu.com> 
 wrote:
 On 3 September 2013 16:54, eles <eles eles.com> wrote:
 It would be possible to implement this for gdc, too:

system shows in colours. So would have to modify the frontend accordingly in that case...

https://github.com/D-Programming-GDC/GDC/commit/b2a4421180f70475b52497a75ab0fe760ebc82d7

Great! Could you make fdiagnostic-color=auto by default? (instead of never). Just like gcc. Thank you.
Oct 01 2013
prev sibling next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
--001a1134a67a02e1dc04e7aafb2b
Content-Type: text/plain; charset=ISO-8859-1

On Oct 1, 2013 8:20 AM, "eles" <eles eles.com> wrote:
 On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw wrote:
 On 3 September 2013 17:03, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 On 3 September 2013 16:54, eles <eles eles.com> wrote:
 It would be possible to implement this for gdc, too:

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...



 Great! Could you make fdiagnostic-color=auto by default? (instead of

 Thank you.

I'll check to see if you are correct. :) Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; --001a1134a67a02e1dc04e7aafb2b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <p><br> On Oct 1, 2013 8:20 AM, &quot;eles&quot; &lt;<a href=3D"mailto:eles eles.co= m">eles eles.com</a>&gt; wrote:<br> &gt;<br> &gt; On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw wrote:<br> &gt;&gt;<br> &gt;&gt; On 3 September 2013 17:03, Iain Buclaw &lt;<a href=3D"mailto:ibucl= aw ubuntu.com">ibuclaw ubuntu.com</a>&gt; wrote:<br> &gt;&gt;&gt;<br> &gt;&gt;&gt; On 3 September 2013 16:54, eles &lt;<a href=3D"mailto:eles ele= s.com">eles eles.com</a>&gt; wrote:<br> &gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; It would be possible to implement this for gdc, too:<br> &gt;&gt;&gt;<br> &gt;&gt;&gt; As for errors, only errors that go through the gcc error syste= m shows<br> &gt;&gt;&gt;<br> &gt;&gt;&gt; in colours. =A0So would have to modify the frontend accordingl= y in that<br> &gt;&gt;&gt; case...<br> &gt;&gt;&gt;<br> &gt;&gt;<br> &gt;&gt; <a href=3D"https://github.com/D-Programming-GDC/GDC/commit/b2a4421= 180f70475b52497a75ab0fe760ebc82d7">https://github.com/D-Programming-GDC/GDC= /commit/b2a4421180f70475b52497a75ab0fe760ebc82d7</a><br> &gt;<br> &gt;<br> &gt; Great! Could you make fdiagnostic-color=3Dauto by default? (instead of= never). Just like gcc.<br> &gt;<br> &gt; Thank you.</p> <p>I&#39;ll check to see if you are correct. :)</p> <p>Regards<br> -- <br> Iain Buclaw</p> <p>*(p &lt; e ? p++ : p) =3D (c &amp; 0x0f) + &#39;0&#39;;</p> --001a1134a67a02e1dc04e7aafb2b--
Oct 01 2013
prev sibling next sibling parent "eles" <eles eles.com> writes:
On Tuesday, 1 October 2013 at 09:57:38 UTC, Iain Buclaw wrote:
 On Oct 1, 2013 8:20 AM, "eles" <eles eles.com> wrote:
 On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw wrote:
 On 3 September 2013 17:03, Iain Buclaw <ibuclaw ubuntu.com> 
 wrote:
 On 3 September 2013 16:54, eles <eles eles.com> wrote:
 It would be possible to implement this for gdc, too:

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...



 Great! Could you make fdiagnostic-color=auto by default? 
 (instead of


Sorry, I think I made a mistake. Actually, it depends of the state of the variable GCC_COLORS: "-fno-diagnostics-color Use color in diagnostics. WHEN is ‘never’, ‘always’, or ‘auto’. The default is ‘never’ if GCC_COLORS environment variable isn't present in the environment, and ‘auto’ otherwise. ‘auto’ means to use color only when the standard error is a terminal. The forms -fdiagnostics-color and -fno-diagnostics-color are aliases for -fdiagnostics-color=always and -fdiagnostics-color=never, respectively." http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html It seems to work the same way.
Oct 01 2013
prev sibling next sibling parent "eles" <eles eles.com> writes:
On Tuesday, 1 October 2013 at 11:47:31 UTC, eles wrote:
 On Tuesday, 1 October 2013 at 09:57:38 UTC, Iain Buclaw wrote:
 On Oct 1, 2013 8:20 AM, "eles" <eles eles.com> wrote:
 On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw wrote:
 On 3 September 2013 17:03, Iain Buclaw <ibuclaw ubuntu.com> 
 wrote:
 On 3 September 2013 16:54, eles <eles eles.com> wrote:





Use color in diagnostics. WHEN is ‘never’, ‘always’, or ‘auto’. The default is ‘never’ if GCC_COLORS environment variable isn't present in the environment, and ‘auto’ otherwise. ‘auto’ means to use color only when the standard error is a terminal. The forms -fdiagnostics-color and -fno-diagnostics-color are aliases for -fdiagnostics-color=always and -fdiagnostics-color=never, respectively." http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html It seems to work the same way.

Wowo, it *really* works if i set up the GCC_COLORS For the record, here's mine: export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01;36:quote=01'
Oct 01 2013
prev sibling next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
--001a11c2310efcbc1804e7ba17f8
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On Oct 1, 2013 12:50 PM, "eles" <eles eles.com> wrote:
 On Tuesday, 1 October 2013 at 11:47:31 UTC, eles wrote:
 On Tuesday, 1 October 2013 at 09:57:38 UTC, Iain Buclaw wrote:
 On Oct 1, 2013 8:20 AM, "eles" <eles eles.com> wrote:
 On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw wrote:
 On 3 September 2013 17:03, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 On 3 September 2013 16:54, eles <eles eles.com> wrote:





Use color in diagnostics. WHEN is =91never=92, =91always=92, or =91auto=


default is =91never=92 if GCC_COLORS environment variable isn't present in = the environment, and =91auto=92 otherwise. =91auto=92 means to use color only w= hen the standard error is a terminal. The forms -fdiagnostics-color and -fno-diagnostics-color are aliases for -fdiagnostics-color=3Dalways and -fdiagnostics-color=3Dnever, respectively."
 http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html

 It seems to work the same way.

Wowo, it *really* works if i set up the GCC_COLORS

Doesn't surprise me. A lot of gcc features work without front end interaction. :) Regards --=20 Iain Buclaw *(p < e ? p++ : p) =3D (c & 0x0f) + '0'; --001a11c2310efcbc1804e7ba17f8 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable <p><br> On Oct 1, 2013 12:50 PM, &quot;eles&quot; &lt;<a href=3D"mailto:eles eles.c= om">eles eles.com</a>&gt; wrote:<br> &gt;<br> &gt; On Tuesday, 1 October 2013 at 11:47:31 UTC, eles wrote:<br> &gt;&gt;<br> &gt;&gt; On Tuesday, 1 October 2013 at 09:57:38 UTC, Iain Buclaw wrote:<br> &gt;&gt;&gt;<br> &gt;&gt;&gt; On Oct 1, 2013 8:20 AM, &quot;eles&quot; &lt;<a href=3D"mailto= :eles eles.com">eles eles.com</a>&gt; wrote:<br> &gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw wr= ote:<br> &gt;&gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt;&gt; On 3 September 2013 17:03, Iain Buclaw &lt;<a href=3D"= mailto:ibuclaw ubuntu.com">ibuclaw ubuntu.com</a>&gt; wrote:<br> &gt;&gt;&gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt;&gt;&gt; On 3 September 2013 16:54, eles &lt;<a href=3D"mai= lto:eles eles.com">eles eles.com</a>&gt; wrote:<br> &gt;&gt;&gt;&gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt;&gt;&gt;&gt;<br> &gt;&gt; &quot;-fno-diagnostics-color<br> &gt;&gt; Use color in diagnostics. WHEN is =91never=92, =91always=92, or = =91auto=92. The default is =91never=92 if GCC_COLORS environment variable i= sn&#39;t present in the environment, and =91auto=92 otherwise. =91auto=92 m= eans to use color only when the standard error is a terminal. The forms -fd= iagnostics-color and -fno-diagnostics-color are aliases for -fdiagnostics-c= olor=3Dalways and -fdiagnostics-color=3Dnever, respectively.&quot;<br> &gt;&gt;<br> &gt;&gt; <a href=3D"http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-= Options.html">http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Option= s.html</a><br> &gt;&gt;<br> &gt;&gt; It seems to work the same way.<br> &gt;<br> &gt;<br> &gt; Wowo, it *really* works if i set up the GCC_COLORS<br> &gt;</p> <p>Doesn&#39;t surprise me.=A0 A lot of gcc features work without front end= interaction.=A0 :)</p> <p>Regards<br> -- <br> Iain Buclaw</p> <p>*(p &lt; e ? p++ : p) =3D (c &amp; 0x0f) + &#39;0&#39;;<br> </p> --001a11c2310efcbc1804e7ba17f8--
Oct 01 2013
prev sibling next sibling parent "Dejan Lekic" <dejan.lekic gmail.com> writes:
On Tuesday, 1 October 2013 at 11:49:54 UTC, eles wrote:
 On Tuesday, 1 October 2013 at 11:47:31 UTC, eles wrote:
 On Tuesday, 1 October 2013 at 09:57:38 UTC, Iain Buclaw wrote:
 On Oct 1, 2013 8:20 AM, "eles" <eles eles.com> wrote:
 On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw 
 wrote:
 On 3 September 2013 17:03, Iain Buclaw <ibuclaw ubuntu.com> 
 wrote:
 On 3 September 2013 16:54, eles <eles eles.com> wrote:





Use color in diagnostics. WHEN is ‘never’, ‘always’, or ‘auto’. The default is ‘never’ if GCC_COLORS environment variable isn't present in the environment, and ‘auto’ otherwise. ‘auto’ means to use color only when the standard error is a terminal. The forms -fdiagnostics-color and -fno-diagnostics-color are aliases for -fdiagnostics-color=always and -fdiagnostics-color=never, respectively." http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html It seems to work the same way.

Wowo, it *really* works if i set up the GCC_COLORS For the record, here's mine: export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01;36:quote=01'

Thanks for this info, I did not know about it. :) \o/
Oct 07 2013
prev sibling parent "eles" <eles eles.com> writes:
On Monday, 7 October 2013 at 13:00:10 UTC, Dejan Lekic wrote:
 On Tuesday, 1 October 2013 at 11:49:54 UTC, eles wrote:
 On Tuesday, 1 October 2013 at 11:47:31 UTC, eles wrote:
 On Tuesday, 1 October 2013 at 09:57:38 UTC, Iain Buclaw wrote:
 On Oct 1, 2013 8:20 AM, "eles" <eles eles.com> wrote:
 On Tuesday, 1 October 2013 at 03:36:09 UTC, Iain Buclaw 
 wrote:
 On 3 September 2013 17:03, Iain Buclaw 
 <ibuclaw ubuntu.com> wrote:
 On 3 September 2013 16:54, eles <eles eles.com> wrote:






export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01;36:quote=01'

Thanks for this info, I did not know about it. :) \o/

glad it is useful
Oct 07 2013