Skip to content

Commit b27c1e8

Browse files
author
Daniel Kroening
committed
use colors in gcc personality
This mimicks what newer versions of gcc do.
1 parent f133a25 commit b27c1e8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/util/cout_message.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,16 @@ void gcc_message_handlert::print(
154154
if(!function.empty())
155155
{
156156
if(!file.empty())
157-
dest+=id2string(file)+":";
157+
dest += command(1) + id2string(file) + ":" + command(0); // bold
158158
if(dest!="")
159159
dest+=' ';
160160
dest+="In function '"+id2string(function)+"':\n";
161161
}
162162

163163
if(!line.empty())
164164
{
165+
dest += command(1); // bold
166+
165167
if(!file.empty())
166168
dest+=id2string(file)+":";
167169

@@ -173,9 +175,11 @@ void gcc_message_handlert::print(
173175
dest+=id2string(column)+": ";
174176

175177
if(level==messaget::M_ERROR)
176-
dest+="error: ";
178+
dest += command(31) + "error: "; // red
177179
else if(level==messaget::M_WARNING)
178-
dest+="warning: ";
180+
dest += command(95) + "warning: "; // bright magenta
181+
182+
dest += command(0); // reset
179183
}
180184

181185
dest+=message;

src/util/cout_message.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class console_message_handlert : public message_handlert
5454
bool use_SGR;
5555
};
5656

57-
class gcc_message_handlert : public message_handlert
57+
class gcc_message_handlert : public console_message_handlert
5858
{
5959
public:
6060
// aims to imitate the messages gcc prints

0 commit comments

Comments
 (0)