views:

210

answers:

4

Hi,

i'm currently refactoring a C-project, throwing about 1000 warnings at me. is there a way to highlight and filter these warnings. (eg make all index warnings red, unused blue, and some other)

most likely some ides can do that, but that's no solution for me.

+1  A: 

Have you tried colorgcc?

JesperE
+2  A: 

Try the colorgcc Debian package. There are also three other packages I found: Johannes Schlüter's colorgcc, or this package in German, or this Sourceforge project

user9876
A: 

Compiling in emacs gives you some highlighting. Presumable the details are amenable to customization.

Use M-x compile and issue you usual build command (defaults to make -k).

dmckee
A: 

G'day,

This answer is mor about the general approach to reworking old C code.

Large volumes of warnings usually are repetitions of the same small group of warnings because of some errors in header files that are included all over the place by other source code files.

If you're refactoring an old C project, quite often most warning come down to various things such as old K'n'R function dec's, previously allowed casts now being highlighted with a warning, using deprecated functions, etc.

Assuming you're using (g)make to build the project, I'd run the compile using the following command:

gmake 2>&1 | tee results

Then you can have a look at the results file and see what are the most popular warnings you're getting. Start with eliminating all existing warnings before getting on to any refactoring of the code base.

Oops. I forgot to say that running the make from within vim gives you lots of possibilities to couple the error and warning messages with the source files.

HTH

cheers,

Rob Wells