linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add -fno-show-column
@ 2009-01-10 14:19 Hannes Eder
  2009-01-10 22:36 ` Christopher Li
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Eder @ 2009-01-10 14:19 UTC (permalink / raw)
  To: linux-sparse

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(-)

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)
 .


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add -fno-show-column
  2009-01-10 14:19 [PATCH] Add -fno-show-column Hannes Eder
@ 2009-01-10 22:36 ` Christopher Li
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Li @ 2009-01-10 22:36 UTC (permalink / raw)
  To: Hannes Eder; +Cc: linux-sparse

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-10 22:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-10 14:19 [PATCH] Add -fno-show-column Hannes Eder
2009-01-10 22:36 ` Christopher Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).