Gcc

From Attie's Wiki
Revision as of 12:34, 9 April 2014 by Attie (Talk | contribs)

Jump to: navigation, search

Highlight the output of gcc

  • warnings will be highlighted yellow
  • errors will be highlighted red
make 2>&1 | \
  sed -re 's/^([^:]+:[0-9]+:[0-9]+: warning: .+)$/\x1B[93m&\x1B[m/g' \
       -e 's/^([^:]+:[0-9]+:[0-9]+: error: .+)$/\x1B[91m&\x1B[m/g'

Or try this one, to dim everything that isn't interesting, and highlight TODO's:

make "$@" 2>&1 | \
  sed -re 's/^[^:]+:[0-9]+:[0-9]+: warning: .+$/\x1B[93m&\x1B[m/g' \
       -e 's/^[^:]+:[0-9]+:[0-9]+: error: .+$/\x1B[91m&\x1B[m/g' \
       -e 's/^[^:]+: In function \x27[^\x27]+\x27:$/\x1B[97m&\x1B[m/g' \
       -e 's/^[^\x1B].+$/\x1B[90m&\x1B[m/g' \
       -e 's/^(\x1B\[93m.*)(TODO)(.*)$/\1\x1B[96m\2\x1B[93m\3/g'

script form

Or, put this in your path, called mk or something:

#!/bin/bash
make "$@" 2>&1 | \
  sed -re 's/^[^:]+:[0-9]+:[0-9]+: warning: .+$/\x1B[93m&\x1B[m/g' \
       -e 's/^[^:]+:[0-9]+:[0-9]+: error: .+$/\x1B[91m&\x1B[m/g' \
       -e 's/^[^:]+: In function \x27[^\x27]+\x27:$/\x1B[97m&\x1B[m/g' \
       -e 's/^[^\x1B].+$/\x1B[90m&\x1B[m/g' \
       -e 's/^(\x1B\[93m.*)(TODO)(.*)$/\1\x1B[96m\2\x1B[93m\3/g'
exit $?
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox