Skip to content

Commit abb3b57

Browse files
committed
csgrep --remove-duplicates: use the same path filters as csdiff
This is a follow-up to csdiff-2.0.0-18-g2bd9f64.
1 parent 31b4b27 commit abb3b57

File tree

4 files changed

+1
-118
lines changed

4 files changed

+1
-118
lines changed

src/csgrep.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ class DuplicateFilter: public AbstractFilter {
360360
DefEvent evt = def.events[def.keyEventIdx];
361361

362362
// abstract out differences we do not deem important
363+
evt.fileName = MsgFilter::inst()->filterPath(evt.fileName);
363364
evt.msg = MsgFilter::inst()->filterMsg(evt.msg, def.checker);
364365

365366
return lookup_.insert(evt)./* inserted */second;

tests/csgrep/12-llvm-build-warnings-stdout.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,6 @@ Error: COMPILER_WARNING:
406406
# ret = qemuMonitorJSONBlockCommit(mon, device, top, base, speed);
407407
# ^ ~~~
408408

409-
Error: COMPILER_WARNING:
410-
/tmp/tmpObFhPl.c:1: warning: return type defaults to 'int'
411-
412-
Error: COMPILER_WARNING:
413-
/tmp/tmpObFhPl.c:1: warning: '__dtrace' defined but not used
414-
415409
Error: COMPILER_WARNING:
416410
/builddir/build/BUILD/libvirt-0.10.2/src/qemu/qemu_driver.c:8587:22: warning: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc'
417411
# if ((rc = qemuSetEmulatorBandwidthLive(vm, group, value_ul, 0)))
@@ -477,16 +471,6 @@ Error: COMPILER_WARNING:
477471
# if (!(dh = opendir(*root))) {
478472
# ^ ~~~~~
479473

480-
Error: COMPILER_WARNING:
481-
/tmp/tmpObFhPl.c:1:8: warning[-Wimplicit-int]: type specifier missing, defaults to 'int'
482-
#static __dtrace () {}
483-
#~~~~~~ ^
484-
485-
Error: COMPILER_WARNING:
486-
/tmp/tmpObFhPl.c:1:21: warning[-Wreturn-type]: control reaches end of non-void function
487-
#static __dtrace () {}
488-
# ^
489-
490474
Error: COMPILER_WARNING:
491475
/builddir/build/BUILD/libvirt-0.10.2/src/lxc/lxc_process.c:466:17: warning: Value stored to 'fail' is never read
492476
# fail = true;

tests/csgrep/13-llvm-build-warnings-stdout.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,6 @@ Error: COMPILER_WARNING:
406406
# ret = qemuMonitorJSONBlockCommit(mon, device, top, base, speed);
407407
# ^ ~~~
408408

409-
Error: COMPILER_WARNING:
410-
/tmp/tmpObFhPl.c:1: warning: return type defaults to 'int'
411-
412-
Error: COMPILER_WARNING:
413-
/tmp/tmpObFhPl.c:1: warning: '__dtrace' defined but not used
414-
415409
Error: COMPILER_WARNING:
416410
/builddir/build/BUILD/libvirt-0.10.2/src/qemu/qemu_driver.c:8587:22: warning: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc'
417411
# if ((rc = qemuSetEmulatorBandwidthLive(vm, group, value_ul, 0)))
@@ -477,16 +471,6 @@ Error: COMPILER_WARNING:
477471
# if (!(dh = opendir(*root))) {
478472
# ^ ~~~~~
479473

480-
Error: COMPILER_WARNING:
481-
/tmp/tmpObFhPl.c:1:8: warning[-Wimplicit-int]: type specifier missing, defaults to 'int'
482-
#static __dtrace () {}
483-
#~~~~~~ ^
484-
485-
Error: COMPILER_WARNING:
486-
/tmp/tmpObFhPl.c:1:21: warning[-Wreturn-type]: control reaches end of non-void function
487-
#static __dtrace () {}
488-
# ^
489-
490474
Error: COMPILER_WARNING:
491475
/builddir/build/BUILD/libvirt-0.10.2/src/lxc/lxc_process.c:466:17: warning: Value stored to 'fail' is never read
492476
# fail = true;

tests/csgrep/14-llvm-build-warnings-stdout.txt

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,34 +2508,6 @@
25082508
}
25092509
]
25102510
},
2511-
{
2512-
"checker": "COMPILER_WARNING",
2513-
"language": "c/c++",
2514-
"key_event_idx": 0,
2515-
"events": [
2516-
{
2517-
"file_name": "/tmp/tmpObFhPl.c",
2518-
"line": 1,
2519-
"event": "warning",
2520-
"message": "return type defaults to 'int'",
2521-
"verbosity_level": "0"
2522-
}
2523-
]
2524-
},
2525-
{
2526-
"checker": "COMPILER_WARNING",
2527-
"language": "c/c++",
2528-
"key_event_idx": 0,
2529-
"events": [
2530-
{
2531-
"file_name": "/tmp/tmpObFhPl.c",
2532-
"line": 1,
2533-
"event": "warning",
2534-
"message": "'__dtrace' defined but not used",
2535-
"verbosity_level": "0"
2536-
}
2537-
]
2538-
},
25392511
{
25402512
"checker": "COMPILER_WARNING",
25412513
"language": "c/c++",
@@ -2913,64 +2885,6 @@
29132885
}
29142886
]
29152887
},
2916-
{
2917-
"checker": "COMPILER_WARNING",
2918-
"language": "c/c++",
2919-
"key_event_idx": 0,
2920-
"events": [
2921-
{
2922-
"file_name": "/tmp/tmpObFhPl.c",
2923-
"line": 1,
2924-
"column": 8,
2925-
"event": "warning[-Wimplicit-int]",
2926-
"message": "type specifier missing, defaults to 'int'",
2927-
"verbosity_level": "0"
2928-
},
2929-
{
2930-
"file_name": "",
2931-
"line": 0,
2932-
"event": "#",
2933-
"message": "static __dtrace () {}",
2934-
"verbosity_level": "1"
2935-
},
2936-
{
2937-
"file_name": "",
2938-
"line": 0,
2939-
"event": "#",
2940-
"message": "~~~~~~ ^",
2941-
"verbosity_level": "1"
2942-
}
2943-
]
2944-
},
2945-
{
2946-
"checker": "COMPILER_WARNING",
2947-
"language": "c/c++",
2948-
"key_event_idx": 0,
2949-
"events": [
2950-
{
2951-
"file_name": "/tmp/tmpObFhPl.c",
2952-
"line": 1,
2953-
"column": 21,
2954-
"event": "warning[-Wreturn-type]",
2955-
"message": "control reaches end of non-void function",
2956-
"verbosity_level": "0"
2957-
},
2958-
{
2959-
"file_name": "",
2960-
"line": 0,
2961-
"event": "#",
2962-
"message": "static __dtrace () {}",
2963-
"verbosity_level": "1"
2964-
},
2965-
{
2966-
"file_name": "",
2967-
"line": 0,
2968-
"event": "#",
2969-
"message": " ^",
2970-
"verbosity_level": "1"
2971-
}
2972-
]
2973-
},
29742888
{
29752889
"checker": "COMPILER_WARNING",
29762890
"language": "c/c++",

0 commit comments

Comments
 (0)