From patchwork Tue May 12 07:29:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 471166 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F078F1400A0 for ; Tue, 12 May 2015 17:30:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=r9RBhked; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=pcodc86QQwRYcerxbTDIh/rGXHWygly3J3I3opR4DsomzN i2HutvkqR3/VSqYQzTgbnhAPH6foqJAamrwrAhakQmCFTIrp/n5xMdDyqbTl6kBU jFWuUmfN38kEvYBcdts96KhN38WNV9wpRzr5ukUDVtSgtXSSX4KnwppewHG30= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=EgKamatE39ofrg3Y4CwRgE+MooQ=; b=r9RBhkedcHV3jHsI0r5/ OsvrjmHs57ithv0Y05Us1SQ7aikXhwlu0qEuCp+Bfw04ue22+GJxCYLeg6Gtd2qB n0N39XDreCzg5h+IzTVbFeP1oDNX1eaRdW259TzMUfb/JeiruZV9/RXt5TmMAmcO bmcVjrSw2698CJ8/zRrsDo8= Received: (qmail 48566 invoked by alias); 12 May 2015 07:30:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 48550 invoked by uid 89); 12 May 2015 07:30:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 May 2015 07:29:59 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Ys4dY-0001lL-8b from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Tue, 12 May 2015 00:29:56 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Tue, 12 May 2015 08:29:55 +0100 Message-ID: <5551ABF1.7040908@mentor.com> Date: Tue, 12 May 2015 09:29:53 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: GCC Patches Subject: [PATCH, 5/5] check_GNU_style.sh: Fix tab size in 80 characters check Hi, this patch fixes a problem in the 80 characters length check. Currently tab width is not properly calculated. The patch uses expand to interpret tabs properly. OK for trunk? Thanks, - Tom [PATCH 5/5] check_GNU_style.sh: Fix tab size in 80 characters check 2015-05-11 Tom de Vries * check_GNU_style.sh (col): Fix tab size. --- contrib/check_GNU_style.sh | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh index 318eb6a..90c612f 100755 --- a/contrib/check_GNU_style.sh +++ b/contrib/check_GNU_style.sh @@ -116,13 +116,37 @@ vg (){ col (){ msg="$1" - cat $inp \ - | awk -F':\\+' '{ if (length($2) > 80) print $0}' \ - > $tmp - if [ -s $tmp ]; then - printf "\n$msg\n" - cat $tmp - fi + local first=true + local f + for f in $files; do + local prefix="" + if [ $nfiles -ne 1 ]; then + prefix="$f:" + fi + + # Don't reuse $inp, which may be generated using -H and thus contain a + # file prefix. + grep -n '^+' $f \ + | grep -v ':+++' \ + > $tmp + + cat $tmp | while IFS= read -r line; do + local longline + # Filter out the line number prefix and the patch line modifier '+' + # to obtain the bare line, before we use expand. + longline=$(echo "$line" \ + | sed 's/^[0-9]*:+//' \ + | expand \ + | awk '{ if (length($0) > 80) print $0}') + if [ "$longline" != "" ]; then + if $first; then + printf "\n$msg\n" + first=false + fi + echo "$prefix$line" + fi + done + done } col 'Lines should not exceed 80 characters.' -- 1.9.1