Fix #739 (Pre-defined output format templates)

http://sourceforge.net/apps/trac/cppcheck/ticket/739
Patch from lanurmi. Slightly modified by me.
This commit is contained in:
Reijo Tomperi 2009-09-28 22:48:27 +03:00
parent 2d4404f030
commit 949ad462c7
2 changed files with 6 additions and 1 deletions

View File

@ -211,7 +211,7 @@ files, this is not needed.</para>
<varlistentry>
<term><option>--template ['text']</option></term>
<listitem>
<para>Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or '{file}({line}):({severity}) {message}'</para>
<para>Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or '{file}({line}):({severity}) {message}'. Pre-defined templates: gcc, vs</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -186,6 +186,10 @@ std::string CppCheck::parseFromArgs(int argc, const char* const argv[])
return "cppcheck: argument to '--template' is missing\n";
_settings._outputFormat = argv[i];
if (_settings._outputFormat == "gcc")
_settings._outputFormat = "{file}:{line}: {severity}: {message}";
else if (_settings._outputFormat == "vs")
_settings._outputFormat = "{file}({line}): {severity}: {message}";
}
// Include paths
@ -330,6 +334,7 @@ std::string CppCheck::parseFromArgs(int argc, const char* const argv[])
" --template '[text]' Format the error messages. E.g.\n"
" '{file}:{line},{severity},{id},{message}' or\n"
" '{file}({line}):({severity}) {message}'\n"
" Pre-defined templates: gcc, vs\n"
" --unused-functions Check if there are unused functions\n"
" -v, --verbose More detailed error reports\n"
" --version Print out version number\n"