aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-08-28 17:32:53 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-03-28 18:28:07 (GMT)
commitdbac0eda27cec2c716c2886a83f0a50d23c9a03e (patch)
treefc6dc1da95632721e71421a39d8d84abe0b7ebe2
parent5c0e0166635bf700ef6ea3f91897d6457af7b4bb (diff)
Provide more info on error reports
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--lib.c7
-rw-r--r--lib.h2
-rw-r--r--smatch.h2
3 files changed, 9 insertions, 2 deletions
diff --git a/lib.c b/lib.c
index 8924c2e..df20193 100644
--- a/lib.c
+++ b/lib.c
@@ -103,6 +103,8 @@ unsigned int hexval(unsigned int c)
return retval;
}
+const char *last_fname;
+
static void do_warn(const char *type, struct position pos, const char * fmt, va_list args)
{
static char buffer[512];
@@ -111,8 +113,8 @@ static void do_warn(const char *type, struct position pos, const char * fmt, va_
vsprintf(buffer, fmt, args);
name = stream_name(pos.stream);
- fprintf(stderr, "%s:%d:%d: %s%s\n",
- name, pos.line, pos.pos, type, buffer);
+ fprintf(stderr, "%s:%s:%d:%d: %s%s\n",
+ last_fname, name, pos.line, pos.pos, type, buffer);
}
static int max_warnings = 100;
@@ -1320,6 +1322,7 @@ static struct symbol_list *sparse_file(const char *filename)
if (strcmp (filename, "-") == 0) {
fd = 0;
} else {
+ last_fname = filename;
fd = open(filename, O_RDONLY);
if (fd < 0)
die("No such file: %s", filename);
diff --git a/lib.h b/lib.h
index bfb3546..a514f36 100644
--- a/lib.h
+++ b/lib.h
@@ -4,6 +4,8 @@
#include <stdlib.h>
#include <stddef.h>
+extern const char *last_fname;
+
/*
* Basic helper routine descriptions for 'sparse'.
*
diff --git a/smatch.h b/smatch.h
index c869980..7db96ce 100644
--- a/smatch.h
+++ b/smatch.h
@@ -274,6 +274,8 @@ static inline void print_implied_debug_msg(void)
{
static struct symbol *last_printed = NULL;
+ if (!implied_debug_msg || !strcmp(implied_debug_msg, last_fname))
+ sm_printf("%s: ", last_fname);
if (!implied_debug_msg)
return;
if (last_printed == cur_func_sym)

Privacy Policy