diff --git a/csparser.cc b/csparser.cc index 2d63f93c..ec00a782 100644 --- a/csparser.cc +++ b/csparser.cc @@ -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]+|))?(?::([0-9]+))?" /* evt/mesg */ ": (" RE_EVENT "): (.*)$") { } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 38e9c342..92186383 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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) diff --git a/tests/csgrep/54-csparser-unknown-lineno-args.txt b/tests/csgrep/54-csparser-unknown-lineno-args.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/csgrep/54-csparser-unknown-lineno-stdin.txt b/tests/csgrep/54-csparser-unknown-lineno-stdin.txt new file mode 100644 index 00000000..6d919caf --- /dev/null +++ b/tests/csgrep/54-csparser-unknown-lineno-stdin.txt @@ -0,0 +1,7 @@ +Error: CBMC_WARNING: +:: 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 diff --git a/tests/csgrep/54-csparser-unknown-lineno-stdout.txt b/tests/csgrep/54-csparser-unknown-lineno-stdout.txt new file mode 100644 index 00000000..994c14a9 --- /dev/null +++ b/tests/csgrep/54-csparser-unknown-lineno-stdout.txt @@ -0,0 +1,7 @@ +Error: CBMC_WARNING: +: 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