Gcc
From Attie's Wiki
(Difference between revisions)
m (→script form) |
m (→Highlight the output of gcc) |
||
Line 7: | Line 7: | ||
sed -re 's/^([^:]+:[0-9]+:[0-9]+: warning: .+)$/\x1B[93m&\x1B[m/g' \ | 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/^([^:]+:[0-9]+:[0-9]+: error: .+)$/\x1B[91m&\x1B[m/g' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</source> | </source> | ||
Latest revision as of 14:17, 25 February 2015
[edit] Highlight the output of gcc
- warnings will be highlighted yellow
- errors will be highlighted red
stdbuf -oL 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'
[edit] script form
Or, put this in your path, called mk
or something:
#!/bin/bash set -o pipefail stdbuf -oL make "$@" 2>&1 | \ sed -ure 's/^[^:]+:[0-9]+:[0-9]+: warning: .+$/\x1B[38;5;208m&\x1B[m/g' \ -e 's/^[^:]+:[0-9]+:[0-9]+: (fatal )?error: .+$/\x1B[38;5;161m&\x1B[m/g' \ -e 's/^.+: undefined reference to .+$/\x1B[38;5;161m&\x1B[m/g' \ -e 's/^[^:]+:[0-9]+:[0-9]+: note: .+$/\x1B[38;5;94m&\x1B[m/g' \ -e 's/^[^:]+: In function .+$/\x1B[38;5;34m&\x1B[m/g' \ -e 's/^(\x1B\[38;5;208m.*)(TODO)(.*)$/\1\x1B[38;5;33m\2\x1B[38;5;208m\3/g' \ -e 's/^(make(\[[0-9]*\])?: (Entering|Leaving) directory )(`.*)$/\x1B[38;5;90m\1\x1B[38;5;200m\4\x1B[m/g' \ -e 's/^[^\x1B].+$/\x1B[90m&\x1B[m/g' exit $?