Skip to content

Commit 43ae0e8

Browse files
committed
gcc-parser: do not merge notes with different location info
1 parent e708daf commit 43ae0e8

File tree

5 files changed

+97
-1
lines changed

5 files changed

+97
-1
lines changed

gcc-parser.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,14 @@ bool MultilineConcatenator::tryMerge(DefEvent *pEvt) {
269269
return false;
270270

271271
if (pEvt->event != lastEvt_.event)
272+
// different kind of event
272273
return false;
273274

274-
// TODO: compare also the location info?
275+
if (pEvt->fileName != lastEvt_.fileName
276+
|| pEvt->line != lastEvt_.line
277+
|| pEvt->column != lastEvt_.column)
278+
// different location info
279+
return false;
275280

276281
boost::smatch smBase;
277282
if (!boost::regex_match(pEvt->msg, smBase, reBase_))

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ test_csgrep(csgrep "41-gcc-parser-pylint" )
151151
test_csgrep(csgrep "42-gcc-parser-smatch" )
152152
test_csgrep(csgrep "43-gcc-parser-smatch" )
153153
test_csgrep(csgrep "44-csparser-new-key-evts" )
154+
test_csgrep(csgrep "45-gcc-parser-clang" )
154155
test_csparser(csparser-5.8 00)
155156
test_csparser(csparser-5.8 01)
156157
test_csparser(csparser-5.8 02)

tests/csgrep/45-gcc-parser-clang-args.txt

Whitespace-only changes.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:967:3: warning: 1st function call argument is an uninitialized value <--[clang]
2+
set_fields (spec_list_string,
3+
^ ~~~~~~~~~~~~~~~~
4+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:926:38: note: Assuming the condition is true <--[clang]
5+
output_delimiter_length = (optarg[0] == '\0'
6+
^~~~~~~~~~~~~~~~~
7+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:926:38: note: '?' condition is true <--[clang]
8+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:929:11: note: Execution continues on line 857 <--[clang]
9+
break;
10+
^
11+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:857:10: note: Assuming the condition is false <--[clang]
12+
while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1)
13+
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:857:3: note: Loop condition is false. Execution continues on line 956 <--[clang]
15+
while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1)
16+
^
17+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:956:7: note: Assuming 'operating_mode' is not equal to undefined_mode <--[clang]
18+
if (operating_mode == undefined_mode)
19+
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:956:3: note: Taking false branch <--[clang]
21+
if (operating_mode == undefined_mode)
22+
^
23+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:959:23: note: Left side of '&&' is false <--[clang]
24+
if (delim_specified && operating_mode != field_mode)
25+
^
26+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:963:7: note: Assuming 'suppress_non_delimited' is 0 <--[clang]
27+
if (suppress_non_delimited && operating_mode != field_mode)
28+
^~~~~~~~~~~~~~~~~~~~~~
29+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:963:30: note: Left side of '&&' is false <--[clang]
30+
if (suppress_non_delimited && operating_mode != field_mode)
31+
^
32+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:968:18: note: Assuming 'operating_mode' is not equal to field_mode <--[clang]
33+
( (operating_mode == field_mode) ? 0 : SETFLD_ERRMSG_USE_POS)
34+
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
35+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:968:17: note: '?' condition is false <--[clang]
36+
( (operating_mode == field_mode) ? 0 : SETFLD_ERRMSG_USE_POS)
37+
^
38+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:969:18: note: Assuming 'complement' is 0 <--[clang]
39+
| (complement ? SETFLD_COMPLEMENT : 0) );
40+
^~~~~~~~~~
41+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:969:18: note: '?' condition is false <--[clang]
42+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:967:3: note: 1st function call argument is an uninitialized value <--[clang]
43+
set_fields (spec_list_string,
44+
^ ~~~~~~~~~~~~~~~~
45+
1 warning generated.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Error: CLANG_WARNING:
2+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:967:3: warning: 1st function call argument is an uninitialized value
3+
# set_fields (spec_list_string,
4+
# ^ ~~~~~~~~~~~~~~~~
5+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:926:38: note: Assuming the condition is true
6+
# output_delimiter_length = (optarg[0] == '\0'
7+
# ^~~~~~~~~~~~~~~~~
8+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:926:38: note: '?' condition is true
9+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:929:11: note: Execution continues on line 857
10+
# break;
11+
# ^
12+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:857:10: note: Assuming the condition is false
13+
# while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1)
14+
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:857:3: note: Loop condition is false. Execution continues on line 956
16+
# while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1)
17+
# ^
18+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:956:7: note: Assuming 'operating_mode' is not equal to undefined_mode
19+
# if (operating_mode == undefined_mode)
20+
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:956:3: note: Taking false branch
22+
# if (operating_mode == undefined_mode)
23+
# ^
24+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:959:23: note: Left side of '&&' is false
25+
# if (delim_specified && operating_mode != field_mode)
26+
# ^
27+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:963:7: note: Assuming 'suppress_non_delimited' is 0
28+
# if (suppress_non_delimited && operating_mode != field_mode)
29+
# ^~~~~~~~~~~~~~~~~~~~~~
30+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:963:30: note: Left side of '&&' is false
31+
# if (suppress_non_delimited && operating_mode != field_mode)
32+
# ^
33+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:968:18: note: Assuming 'operating_mode' is not equal to field_mode
34+
# ( (operating_mode == field_mode) ? 0 : SETFLD_ERRMSG_USE_POS)
35+
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
36+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:968:17: note: '?' condition is false
37+
# ( (operating_mode == field_mode) ? 0 : SETFLD_ERRMSG_USE_POS)
38+
# ^
39+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:969:18: note: Assuming 'complement' is 0
40+
# | (complement ? SETFLD_COMPLEMENT : 0) );
41+
# ^~~~~~~~~~
42+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:969:18: note: '?' condition is false
43+
/builddir/build/BUILD/coreutils-8.30/src/cut.c:967:3: note: 1st function call argument is an uninitialized value
44+
# set_fields (spec_list_string,
45+
# ^ ~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)