Skip to content

Commit d95f29b

Browse files
committed
Fixed test/cli
1 parent 2d9a131 commit d95f29b

12 files changed

Lines changed: 38 additions & 37 deletions

File tree

cli/cmdlineparser.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
#include <tinyxml2.h>
4545
#endif
4646

47-
// The default template format is "gcc"
48-
static const char GCC_TEMPLATE_FORMAT[] = "{file}:{line}:{column}: warning: {message} [{id}]\\n{code}";
49-
static const char GCC_TEMPLATE_LOCATION[] = "{file}:{line}:{column}: note: {info}\\n{code}";
50-
5147
static void addFilesToList(const std::string& FileList, std::vector<std::string>& PathNames)
5248
{
5349
// To keep things initially simple, if the file can't be opened, just be silent and move on.
@@ -642,8 +638,8 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
642638
}
643639

644640
if (mSettings->templateFormat == "gcc") {
645-
mSettings->templateFormat = GCC_TEMPLATE_FORMAT;
646-
mSettings->templateLocation = GCC_TEMPLATE_LOCATION;
641+
mSettings->templateFormat = "{file}:{line}:{column}: warning: {message} [{id}]\\n{code}";
642+
mSettings->templateLocation = "{file}:{line}:{column}: note: {info}\\n{code}";
647643
} else if (mSettings->templateFormat == "daca2") {
648644
mSettings->templateFormat = "{file}:{line}:{column}: {severity}: {message} [{id}]";
649645
mSettings->templateLocation = "{file}:{line}:{column}: note: {info}";
@@ -890,9 +886,9 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
890886

891887
// Default template format..
892888
if (mSettings->templateFormat.empty()) {
893-
mSettings->templateFormat = GCC_TEMPLATE_FORMAT;
889+
mSettings->templateFormat = "{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}";
894890
if (mSettings->templateLocation.empty())
895-
mSettings->templateLocation = GCC_TEMPLATE_LOCATION;
891+
mSettings->templateLocation = "{file}:{line}:{column}: note: {info}\\n{code}";
896892
}
897893

898894
mSettings->project.ignorePaths(mIgnoredPaths);

lib/cppcheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
337337
fdump << " <tok "
338338
<< "fileIndex=\"" << tok->location.fileIndex << "\" "
339339
<< "linenr=\"" << tok->location.line << "\" "
340-
<< "col=\"" << tok->location.col << "\" "
340+
<< "column=\"" << tok->location.col << "\" "
341341
<< "str=\"" << ErrorLogger::toxml(tok->str()) << "\""
342342
<< "/>" << std::endl;
343343
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
samples\AssignmentAddressToInteger\bad.c:3:0: warning: Assigning a pointer to an integer is not portable. [AssignmentAddressToInteger]
1+
samples\AssignmentAddressToInteger\bad.c:3:0: portability: Assigning a pointer to an integer is not portable. [AssignmentAddressToInteger]
22
int a = p;
33
^
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
samples\arrayIndexOutOfBounds\bad.c:7:6: warning: Array 'a[2]' accessed at index 2, which is out of bounds. [arrayIndexOutOfBounds]
1+
samples\arrayIndexOutOfBounds\bad.c:7:6: error: Array 'a[2]' accessed at index 2, which is out of bounds. [arrayIndexOutOfBounds]
22
a[2] = 0;
33
^

samples/autoVariables/out.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
samples\autoVariables\bad.c:4:5: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
1+
samples\autoVariables\bad.c:4:5: error: Address of local auto-variable assigned to a function parameter. [autoVariables]
22
*a = &b;
33
^
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
samples\bufferAccessOutOfBounds\bad.c:6:10: warning: Array 'a[2]' accessed at index 2, which is out of bounds. [arrayIndexOutOfBounds]
1+
samples\bufferAccessOutOfBounds\bad.c:6:10: error: Array 'a[2]' accessed at index 2, which is out of bounds. [arrayIndexOutOfBounds]
22
a[i] = 0;
33
^

samples/erase/out.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
samples\erase\bad.cpp:9:32: warning: Using iterator to local container 'items' that may be invalid. [invalidContainer]
1+
samples\erase\bad.cpp:9:32: error: Using iterator to local container 'items' that may be invalid. [invalidContainer]
22
for (iter = items.begin(); iter != items.end(); ++iter) {
33
^
44
samples\erase\bad.cpp:9:17: note: Iterator to container is created here.

samples/outOfBounds/out.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
samples\outOfBounds\bad.c:5:12: warning: Buffer is accessed out of bounds: str [bufferAccessOutOfBounds]
1+
samples\outOfBounds\bad.c:5:12: error: Buffer is accessed out of bounds: str [bufferAccessOutOfBounds]
22
strcpy(str, "0123456789abcdef");
33
^

samples/resourceLeak/out.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
samples\resourceLeak\bad.c:8:5: warning: Resource leak: a [resourceLeak]
1+
samples\resourceLeak\bad.c:8:5: error: Resource leak: a [resourceLeak]
22
return 0;
33
^

samples/syntaxError/out.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
samples\syntaxError\bad.c:2:1: warning: Unmatched '{'. Configuration: ''. [syntaxError]
1+
samples\syntaxError\bad.c:2:1: error: Unmatched '{'. Configuration: ''. [syntaxError]
22

33
^

0 commit comments

Comments
 (0)