From patchwork Sat Jan 10 14:19:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Eder X-Patchwork-Id: 1702 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0AEG4Ru015917 for ; Sat, 10 Jan 2009 06:16:05 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752104AbZAJOTv (ORCPT ); Sat, 10 Jan 2009 09:19:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752324AbZAJOTv (ORCPT ); Sat, 10 Jan 2009 09:19:51 -0500 Received: from mail-bw0-f21.google.com ([209.85.218.21]:56832 "EHLO mail-bw0-f21.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752104AbZAJOTv (ORCPT ); Sat, 10 Jan 2009 09:19:51 -0500 Received: by bwz14 with SMTP id 14so30211334bwz.13 for ; Sat, 10 Jan 2009 06:19:48 -0800 (PST) Received: by 10.103.165.18 with SMTP id s18mr9606806muo.124.1231597188539; Sat, 10 Jan 2009 06:19:48 -0800 (PST) Received: from vmbox.hanneseder.net (chello080109038207.17.14.tuwien.teleweb.at [80.109.38.207]) by mx.google.com with ESMTPS id y37sm36177427mug.6.2009.01.10.06.19.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 10 Jan 2009 06:19:48 -0800 (PST) Received: by vmbox.hanneseder.net (sSMTP sendmail emulation); Sat, 10 Jan 2009 15:19:45 +0100 Subject: [PATCH] Add -fno-show-column To: linux-sparse@vger.kernel.org Date: Sat, 10 Jan 2009 15:19:45 +0100 Message-ID: <20090110141414.7093.82893.stgit@vmbox.hanneseder.net> User-Agent: StGit/0.14.3.292.gb975.dirty MIME-Version: 1.0 From: Hannes Eder Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org 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 --- 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 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) .