Mercurial > projects > ldc
comparison dmd/mars.c @ 1124:e7f0c2b48047
Fix a bug where ::warning() was called with a va_list argument instead of an
actual vararg list.
Also cleaned up the format for warnings. (Previously some would start with
"warning - warning - Warning:" which was a bit redundant)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Wed, 18 Mar 2009 15:03:17 +0100 |
parents | b30fe7e1dbb9 |
children | eeb8b95ea92e |
comparison
equal
deleted
inserted
replaced
1123:165a920f4e88 | 1124:e7f0c2b48047 |
---|---|
107 | 107 |
108 void warning(Loc loc, const char *format, ...) | 108 void warning(Loc loc, const char *format, ...) |
109 { | 109 { |
110 if (global.params.warnings && !global.gag) | 110 if (global.params.warnings && !global.gag) |
111 { | 111 { |
112 fprintf(stdmsg, "warning - "); | 112 va_list ap; |
113 va_list ap; | 113 va_start(ap, format); |
114 va_start(ap, format); | 114 vwarning(loc, format, ap); |
115 char* p = loc.toChars(); | 115 va_end( ap ); |
116 fprintf(stdmsg, "Warning: %s:", p?p:""); | |
117 vfprintf(stdmsg, format, ap); | |
118 va_end( ap ); | |
119 } | 116 } |
120 } | 117 } |
121 | 118 |
122 void verror(Loc loc, const char *format, va_list ap) | 119 void verror(Loc loc, const char *format, va_list ap) |
123 { | 120 { |
133 vfprintf(stdmsg, format, ap); | 130 vfprintf(stdmsg, format, ap); |
134 fprintf(stdmsg, "\n"); | 131 fprintf(stdmsg, "\n"); |
135 fflush(stdmsg); | 132 fflush(stdmsg); |
136 } | 133 } |
137 global.errors++; | 134 global.errors++; |
135 } | |
136 | |
137 void vwarning(Loc loc, const char *format, va_list ap) | |
138 { | |
139 if (global.params.warnings && !global.gag) | |
140 { | |
141 char *p = loc.toChars(); | |
142 | |
143 if (*p) | |
144 fprintf(stdmsg, "%s: ", p); | |
145 mem.free(p); | |
146 | |
147 fprintf(stdmsg, "Warning: "); | |
148 vfprintf(stdmsg, format, ap); | |
149 fprintf(stdmsg, "\n"); | |
150 fflush(stdmsg); | |
151 } | |
138 } | 152 } |
139 | 153 |
140 /*************************************** | 154 /*************************************** |
141 * Call this after printing out fatal error messages to clean up and exit | 155 * Call this after printing out fatal error messages to clean up and exit |
142 * the compiler. | 156 * the compiler. |