summaryrefslogtreecommitdiff
path: root/src/strgen
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-02-12 23:47:50 +0000
committerrubidium <rubidium@openttd.org>2010-02-12 23:47:50 +0000
commitf6dfce6d59aebabbfec6b20f4176b7b04e09b155 (patch)
treeceba4629005268d8074f9d32942cb021ce48c297 /src/strgen
parentb1cce3f70fa536628cf812ddb9b3e0aca8543afc (diff)
downloadopenttd-f6dfce6d59aebabbfec6b20f4176b7b04e09b155.tar.xz
(svn r19114) -Change: [strgen] Modify the outputted format for MSVC builds of strgen so it also shows fatal errors in the 'error list' and it also counts them. (Fatal) errors are marked as warnings so a failing language file is not causing the complete compilation to fail.
Diffstat (limited to 'src/strgen')
-rw-r--r--src/strgen/strgen.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index 0a9d4fe3b..b6eb880b9 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -138,9 +138,9 @@ static LangString *HashFind(const char *s)
}
#ifdef _MSC_VER
-# define LINE_NUM_FMT "(%d)"
+# define LINE_NUM_FMT(s) "%s (%d): warning: %s (" s ")\n"
#else
-# define LINE_NUM_FMT ":%d"
+# define LINE_NUM_FMT(s) "%s: :%d: " s ": %s\n"
#endif
static void CDECL strgen_warning(const char *s, ...) WARN_FORMAT(1, 2);
@@ -152,7 +152,7 @@ static void CDECL strgen_warning(const char *s, ...)
va_start(va, s);
vsnprintf(buf, lengthof(buf), s, va);
va_end(va);
- fprintf(stderr, "%s" LINE_NUM_FMT ": warning: %s\n", _file, _cur_line, buf);
+ fprintf(stderr, LINE_NUM_FMT("warning"), _file, _cur_line, buf);
_warnings++;
}
@@ -165,7 +165,7 @@ static void CDECL strgen_error(const char *s, ...)
va_start(va, s);
vsnprintf(buf, lengthof(buf), s, va);
va_end(va);
- fprintf(stderr, "%s" LINE_NUM_FMT ": error: %s\n", _file, _cur_line, buf);
+ fprintf(stderr, LINE_NUM_FMT("error"), _file, _cur_line, buf);
_errors++;
}
@@ -176,7 +176,10 @@ void NORETURN CDECL error(const char *s, ...)
va_start(va, s);
vsnprintf(buf, lengthof(buf), s, va);
va_end(va);
- fprintf(stderr, "%s" LINE_NUM_FMT ": FATAL: %s\n", _file, _cur_line, buf);
+ fprintf(stderr, LINE_NUM_FMT("FATAL"), _file, _cur_line, buf);
+#ifdef _MSC_VER
+ fprintf(stderr, LINE_NUM_FMT("warning"), _file, _cur_line, "language is not compiled");
+#endif
/* We were writing output to a file, remove it. */
if (_output_file != NULL) {
fclose(_output_file);