From 949ad462c7e999337192196eac0cb1af97c44917 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Mon, 28 Sep 2009 22:48:27 +0300 Subject: [PATCH] Fix #739 (Pre-defined output format templates) http://sourceforge.net/apps/trac/cppcheck/ticket/739 Patch from lanurmi. Slightly modified by me. --- man/cppcheck.1.xml | 2 +- src/cppcheck.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/man/cppcheck.1.xml b/man/cppcheck.1.xml index 599d0d22c..bed48c154 100644 --- a/man/cppcheck.1.xml +++ b/man/cppcheck.1.xml @@ -211,7 +211,7 @@ files, this is not needed. - Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or '{file}({line}):({severity}) {message}' + Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or '{file}({line}):({severity}) {message}'. Pre-defined templates: gcc, vs diff --git a/src/cppcheck.cpp b/src/cppcheck.cpp index b6fa9e159..302fe4086 100644 --- a/src/cppcheck.cpp +++ b/src/cppcheck.cpp @@ -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"