Skip to content

Commit 9f30ae7

Browse files
committed
csparser: support <unknown> as line number
Reported-By: Vincent Mihalkovic
1 parent bfeb05a commit 9f30ae7

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

csparser.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class ErrFileLexer {
118118
reComment_("^(#)(.*)$"),
119119
reChecker_("^Error: *([A-Za-z][0-9A-Za-z_.]+)( *\\([^)]+\\))? *:$"),
120120
reEvent_(
121-
/* location */ "^([^:]+)(?::([0-9]+))?(?::([0-9]+))?"
121+
/* location */ "^([^:]+)(?::([0-9]+|<unknown>))?(?::([0-9]+))?"
122122
/* evt/mesg */ ": (" RE_EVENT "): (.*)$")
123123
{
124124
}

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ test_csgrep(csgrep "50-gcc-parser-gcc-9.2.1" )
170170
test_csgrep(csgrep "51-gcc-parser-systemd" )
171171
test_csgrep(csgrep "52-gcc-parser-clang-nss" )
172172
test_csgrep(csgrep "53-csparser-note-events" )
173+
test_csgrep(csgrep "54-csparser-unknown-lineno" )
173174
test_csparser(csparser-5.8 00)
174175
test_csparser(csparser-5.8 01)
175176
test_csparser(csparser-5.8 02)

tests/csgrep/54-csparser-unknown-lineno-args.txt

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Error: CBMC_WARNING:
2+
<unknown>:<unknown>: error: memory-leak : dynamically allocated memory never freed in __CPROVER_memory_leak == NULL
3+
one_memory_leak.c:3: note: from_entry_point_function:function-call:main
4+
one_memory_leak.c:4: note: main:4:pointer: str = ((char *)NULL)
5+
one_memory_leak.c:4: note: from_main:function-call:malloc
6+
one_memory_leak.c:4: note: function_parameter_set_in:main:4:integer: malloc_size = 15ul
7+
one_memory_leak.c:5: note: from_main:function-return:main
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Error: CBMC_WARNING:
2+
<unknown>: error: memory-leak : dynamically allocated memory never freed in __CPROVER_memory_leak == NULL
3+
one_memory_leak.c:3: note: from_entry_point_function:function-call:main
4+
one_memory_leak.c:4: note: main:4:pointer: str = ((char *)NULL)
5+
one_memory_leak.c:4: note: from_main:function-call:malloc
6+
one_memory_leak.c:4: note: function_parameter_set_in:main:4:integer: malloc_size = 15ul
7+
one_memory_leak.c:5: note: from_main:function-return:main

0 commit comments

Comments
 (0)