Powered by Linux
[PATCH 13/18] sparse: prefix output with progname — Semantic Matching Tool

[PATCH 13/18] sparse: prefix output with progname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: John Levon <levon@xxxxxxxxxxxxxxxxx>
---
 lib.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib.c b/lib.c
index 8924c2eb..a82408e8 100644
--- a/lib.c
+++ b/lib.c
@@ -45,6 +45,8 @@
 #include "target.h"
 #include "version.h"
 
+static const char *progname;
+
 int verbose, optimize, optimize_size, preprocessing;
 int die_if_error = 0;
 int parse_error;
@@ -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",
+		progname, name, pos.line, pos.pos, type, buffer);
 }
 
 static int max_warnings = 100;
@@ -214,7 +216,7 @@ void die(const char *fmt, ...)
 	vsnprintf(buffer, sizeof(buffer), fmt, args);
 	va_end(args);
 
-	fprintf(stderr, "%s\n", buffer);
+	fprintf(stderr, "%s: %s\n", progname, buffer);
 	exit(1);
 }
 
@@ -1363,6 +1365,8 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list
 	init_symbols();
 	init_include_path();
 
+	progname = argv[0];
+
 	args = argv;
 	for (;;) {
 		char *arg = *++args;
-- 
2.14.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux