Skip to content

Commit b370920

Browse files
committed
use colors in gcc personality
This mimicks what newer versions of gcc do.
1 parent 93156a8 commit b370920

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
@@ -151,14 +151,16 @@ void gcc_message_handlert::print(
151151
if(!function.empty())
152152
{
153153
if(!file.empty())
154-
dest+=id2string(file)+":";
154+
dest += command(1) + id2string(file) + ":" + command(0); // bold
155155
if(dest!="")
156156
dest+=' ';
157157
dest+="In function '"+id2string(function)+"':\n";
158158
}
159159

160160
if(!line.empty())
161161
{
162+
dest += command(1); // bold
163+
162164
if(!file.empty())
163165
dest+=id2string(file)+":";
164166

@@ -170,9 +172,11 @@ void gcc_message_handlert::print(
170172
dest+=id2string(column)+": ";
171173

172174
if(level==messaget::M_ERROR)
173-
dest+="error: ";
175+
dest += command(31) + "error: "; // red
174176
else if(level==messaget::M_WARNING)
175-
dest+="warning: ";
177+
dest += command(95) + "warning: "; // bright magenta
178+
179+
dest += command(0); // reset
176180
}
177181

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