Skip to content

Commit

Permalink
csparser: support <unknown> as line number
Browse files Browse the repository at this point in the history
Reported-By: Vincent Mihalkovic
  • Loading branch information
kdudka committed Mar 19, 2020
1 parent bfeb05a commit 9f30ae7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion csparser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ErrFileLexer {
reComment_("^(#)(.*)$"),
reChecker_("^Error: *([A-Za-z][0-9A-Za-z_.]+)( *\\([^)]+\\))? *:$"),
reEvent_(
/* location */ "^([^:]+)(?::([0-9]+))?(?::([0-9]+))?"
/* location */ "^([^:]+)(?::([0-9]+|<unknown>))?(?::([0-9]+))?"
/* evt/mesg */ ": (" RE_EVENT "): (.*)$")
{
}
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ test_csgrep(csgrep "50-gcc-parser-gcc-9.2.1" )
test_csgrep(csgrep "51-gcc-parser-systemd" )
test_csgrep(csgrep "52-gcc-parser-clang-nss" )
test_csgrep(csgrep "53-csparser-note-events" )
test_csgrep(csgrep "54-csparser-unknown-lineno" )
test_csparser(csparser-5.8 00)
test_csparser(csparser-5.8 01)
test_csparser(csparser-5.8 02)
Expand Down
Empty file.
7 changes: 7 additions & 0 deletions tests/csgrep/54-csparser-unknown-lineno-stdin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Error: CBMC_WARNING:
<unknown>:<unknown>: error: memory-leak : dynamically allocated memory never freed in __CPROVER_memory_leak == NULL
one_memory_leak.c:3: note: from_entry_point_function:function-call:main
one_memory_leak.c:4: note: main:4:pointer: str = ((char *)NULL)
one_memory_leak.c:4: note: from_main:function-call:malloc
one_memory_leak.c:4: note: function_parameter_set_in:main:4:integer: malloc_size = 15ul
one_memory_leak.c:5: note: from_main:function-return:main
7 changes: 7 additions & 0 deletions tests/csgrep/54-csparser-unknown-lineno-stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Error: CBMC_WARNING:
<unknown>: error: memory-leak : dynamically allocated memory never freed in __CPROVER_memory_leak == NULL
one_memory_leak.c:3: note: from_entry_point_function:function-call:main
one_memory_leak.c:4: note: main:4:pointer: str = ((char *)NULL)
one_memory_leak.c:4: note: from_main:function-call:malloc
one_memory_leak.c:4: note: function_parameter_set_in:main:4:integer: malloc_size = 15ul
one_memory_leak.c:5: note: from_main:function-return:main

0 comments on commit 9f30ae7

Please sign in to comment.