Skip to content

Commit 580f708

Browse files
committed
use colors in gcc personality
This mimicks what newer versions of gcc do.
1 parent 087cb20 commit 580f708

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

158158
if(!line.empty())
159159
{
160+
dest += command(1); // bold
161+
160162
if(!file.empty())
161163
dest+=id2string(file)+":";
162164

@@ -168,9 +170,11 @@ void gcc_message_handlert::print(
168170
dest+=id2string(column)+": ";
169171

170172
if(level==messaget::M_ERROR)
171-
dest+="error: ";
173+
dest += command(31) + "error: "; // red
172174
else if(level==messaget::M_WARNING)
173-
dest+="warning: ";
175+
dest += command(95) + "warning: "; // bright magenta
176+
177+
dest += command(0); // reset
174178
}
175179

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