Skip to content

Commit

Permalink
fix Issue 13019 - Different color for "Warning:"
Browse files Browse the repository at this point in the history
Choose colors: Warning -> light yellow, Deprecation -> light blue
  • Loading branch information
9rnsr committed Aug 30, 2014
1 parent fcea2a7 commit 1e27b1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/mars.c
Expand Up @@ -245,8 +245,8 @@ void deprecation(Loc loc, const char *format, ...)
}

// Just print, doesn't care about gagging
void verrorPrint(Loc loc, const char *header, const char *format, va_list ap,
const char *p1, const char *p2)
void verrorPrint(Loc loc, COLOR headerColor, const char *header, const char *format, va_list ap,
const char *p1 = NULL, const char *p2 = NULL)
{
char *p = loc.toChars();

Expand All @@ -257,7 +257,7 @@ void verrorPrint(Loc loc, const char *header, const char *format, va_list ap,
mem.free(p);

if (global.params.color)
setConsoleColor(COLOR_RED, true);
setConsoleColor(headerColor, true);
fputs(header, stderr);
if (global.params.color)
resetConsoleColor();
Expand All @@ -277,15 +277,15 @@ void verror(Loc loc, const char *format, va_list ap,
{
if (!global.gag)
{
verrorPrint(loc, header, format, ap, p1, p2);
verrorPrint(loc, COLOR_RED, header, format, ap, p1, p2);
if (global.errors >= 20) // moderate blizzard of cascading messages
fatal();
//halt();
}
else
{
//fprintf(stderr, "(gag:%d) ", global.gag);
//verrorPrint(loc, header, format, ap, p1, p2);
//verrorPrint(loc, COLOR_RED, header, format, ap, p1, p2);
global.gaggedErrors++;
}
global.errors++;
Expand All @@ -295,14 +295,14 @@ void verror(Loc loc, const char *format, va_list ap,
void verrorSupplemental(Loc loc, const char *format, va_list ap)
{
if (!global.gag)
verrorPrint(loc, " ", format, ap);
verrorPrint(loc, COLOR_RED, " ", format, ap);
}

void vwarning(Loc loc, const char *format, va_list ap)
{
if (global.params.warnings && !global.gag)
{
verrorPrint(loc, "Warning: ", format, ap);
verrorPrint(loc, COLOR_YELLOW, "Warning: ", format, ap);
//halt();
if (global.params.warnings == 1)
global.warnings++; // warnings don't count if gagged
Expand All @@ -316,7 +316,7 @@ void vdeprecation(Loc loc, const char *format, va_list ap,
if (global.params.useDeprecated == 0)
verror(loc, format, ap, p1, p2, header);
else if (global.params.useDeprecated == 2 && !global.gag)
verrorPrint(loc, header, format, ap, p1, p2);
verrorPrint(loc, COLOR_BLUE, header, format, ap, p1, p2);
}

void readFile(Loc loc, File *f)
Expand Down
1 change: 0 additions & 1 deletion src/mars.h
Expand Up @@ -361,7 +361,6 @@ void errorSupplemental(Loc loc, const char *format, ...);
void verror(Loc loc, const char *format, va_list ap, const char *p1 = NULL, const char *p2 = NULL, const char *header = "Error: ");
void vwarning(Loc loc, const char *format, va_list);
void verrorSupplemental(Loc loc, const char *format, va_list ap);
void verrorPrint(Loc loc, const char *header, const char *format, va_list ap, const char *p1 = NULL, const char *p2 = NULL);
void vdeprecation(Loc loc, const char *format, va_list ap, const char *p1 = NULL, const char *p2 = NULL);

#if defined(__GNUC__) || defined(__clang__)
Expand Down

0 comments on commit 1e27b1a

Please sign in to comment.