Page 1 of 1

GCC Output color formatter

Posted: Tue Oct 27, 2015 8:27 pm
by mikejmoffitt
The old version of GCC used with SGDK drives me insane because 1) SGDK spits out a lot of warnings unless you squash them with type casting on resources, and 2) there is no colorization to let you find the one error admist twenty warnings.

I put together a tiny python script towards which you can pipe GCC's error output:

Image

https://github.com/Mikejmoffitt/gccerrc/

Install python3 if your distro hasn't already got it, and configure your makefile in a way that is similar to the usage example shown (on the line with $(CC), add 2>&1 | python3 gccerrc.py)

Re: GCC Output color formatter

Posted: Thu Oct 29, 2015 5:39 pm
by mikejmoffitt
I realize I should have put this in tools...

Re: GCC Output color formatter

Posted: Thu Oct 29, 2015 8:21 pm
by tryphon
Windows console supports color ?

Re: GCC Output color formatter

Posted: Thu Oct 29, 2015 8:42 pm
by Sik
Yeah (16 colors), although not through ANSI escape codes. This is Python though so maybe its API takes care of that anyway? (no idea how it works)

Re: GCC Output color formatter

Posted: Thu Oct 29, 2015 9:36 pm
by tryphon

Code: Select all

print ('\033[1m', end = "");
ANSI code, isn't it ?

Re: GCC Output color formatter

Posted: Thu Oct 29, 2015 9:57 pm
by KanedaFr
I never used this because Eclipse does it for me but did you look at
https://github.com/chinaran/color-compile ?
It seems to achieve the same thing (and even more ?)

Re: GCC Output color formatter

Posted: Thu Oct 29, 2015 11:33 pm
by mikejmoffitt
I have no idea if this will work well in a Windows workflow, so I can't comment on that. No real API is in use here, it's just ANSI escape sequences.

As for the other program, there are several which do similar functionality but I wanted this one as a Python script so when I go between a computer running Darwin and Linux I don't have to recompile the formatter or maintain multiple binaries.