GCC Output color formatter

SGDK only sub forum

Moderator: Stef

Post Reply
mikejmoffitt
Very interested
Posts: 86
Joined: Fri Sep 25, 2015 4:16 pm

GCC Output color formatter

Post by mikejmoffitt » Tue Oct 27, 2015 8:27 pm

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)
Last edited by mikejmoffitt on Thu Oct 29, 2015 5:40 pm, edited 1 time in total.

mikejmoffitt
Very interested
Posts: 86
Joined: Fri Sep 25, 2015 4:16 pm

Re: GCC Output color formatter

Post by mikejmoffitt » Thu Oct 29, 2015 5:39 pm

I realize I should have put this in tools...

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: GCC Output color formatter

Post by tryphon » Thu Oct 29, 2015 8:21 pm

Windows console supports color ?

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: GCC Output color formatter

Post by Sik » Thu Oct 29, 2015 8:42 pm

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)
Sik is pronounced as "seek", not as "sick".

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: GCC Output color formatter

Post by tryphon » Thu Oct 29, 2015 9:36 pm

Code: Select all

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

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Re: GCC Output color formatter

Post by KanedaFr » Thu Oct 29, 2015 9:57 pm

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 ?)

mikejmoffitt
Very interested
Posts: 86
Joined: Fri Sep 25, 2015 4:16 pm

Re: GCC Output color formatter

Post by mikejmoffitt » Thu Oct 29, 2015 11:33 pm

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.

Post Reply