diff mbox

Add -fno-show-column

Message ID 20090110141414.7093.82893.stgit@vmbox.hanneseder.net (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Hannes Eder Jan. 10, 2009, 2:19 p.m. UTC
Do not print column numbers in diagnostic messages.  This may be
necessary if processing the diagnostic messages with a program that
does not understand the column numbers.

The default behaviour of sprase, to print the column numbers, is
left as is by this patch.

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---

This patch applies to the "-chrisl" tree. It would need a minor
modification in the sparse.1 part to apply to Josh's tree as
well.

 lib.c    |   16 +++++++++++++---
 sparse.1 |    6 ++++++
 2 files changed, 19 insertions(+), 3 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Christopher Li Jan. 10, 2009, 10:36 p.m. UTC | #1
On Sat, Jan 10, 2009 at 6:19 AM, Hannes Eder <hannes@hanneseder.net> wrote:
> Do not print column numbers in diagnostic messages.  This may be
> necessary if processing the diagnostic messages with a program that
> does not understand the column numbers.
>
> The default behaviour of sprase, to print the column numbers, is
> left as is by this patch.

Can you elaborate what program does not understand the
column numbers? If it is some program that we don't normally
care, I'd rather keep sparse simple.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib.c b/lib.c
index 2b8d21e..ad98343 100644
--- a/lib.c
+++ b/lib.c
@@ -30,6 +30,7 @@ 
 
 int verbose, optimize, optimize_size, preprocessing;
 int die_if_error = 0;
+static int show_column = 1;
 
 #ifndef __GNUC__
 # define __GNUC__ 2
@@ -90,9 +91,13 @@  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);
+
+	if (show_column)
+		fprintf(stderr, "%s:%d:%d: %s%s\n",
+			name, pos.line, pos.pos, type, buffer);
+	else
+		fprintf(stderr, "%s:%d: %s%s\n",
+			name, pos.line, type, buffer);
 }
 
 static int max_warnings = 100;
@@ -554,6 +559,11 @@  static char **handle_switch_f(char *arg, char **next)
 		arg += 3;
 	}
 	/* handle switch here.. */
+
+	if (!strcmp(arg, "show-column")) {
+		show_column = flag;
+	}
+
 	return next;
 }
 
diff --git a/sparse.1 b/sparse.1
index d7fe444..463ef43 100644
--- a/sparse.1
+++ b/sparse.1
@@ -276,6 +276,12 @@  Set the distance between tab stops.  This helps sparse report correct
 column numbers in warnings or errors.  If the value is less than 1 or
 greater than 100, the option is ignored.  The default is 8.
 .
+.TP
+.B \-fno-show-column
+Do not print column numbers in diagnostic messages.  This may be
+necessary if processing the diagnostic messages with a program that
+does not understand the column numbers.
+.
 .SH SEE ALSO
 .BR cgcc (1)
 .