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@xxxxxxxxxxxxxx> --- 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) . -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html