Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp511897imu; Tue, 11 Dec 2018 03:04:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/XhDHv567QQxY/g9oZYzbAW/yaoheJNFUB5iSXEFjk8mgl9Vnh6Z/4LotXEbjYdSVMB+FnL X-Received: by 2002:a63:d157:: with SMTP id c23mr14061259pgj.170.1544526286668; Tue, 11 Dec 2018 03:04:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544526286; cv=none; d=google.com; s=arc-20160816; b=pgI317+ioDEB6rfPgC4eVruoS6PGi2E1yMd3S/g0lhw5inhn3XlNmhQFGojIn9oV34 hJP1+sCzhdTfh+ilusvqUtWb7cp9SlaFhRpoPmOdt199KSwoX69uCpl5/8jiQWSjQQGg lG5UQBMhu3NgycPTbrrVE2B1L+9mE6wk+XkRlefh8HdSWeyMexQeTJOFBzzLYPYW4W6g wtkGeuyccuF562t6MvHJ2f9trc8oHiQJ20TGIui9ylR0vdOePTCSqUhU93tjl2k2H8W4 FT9jEDNrcczlZXT1rK7QkhveLhxDZn/PParlSnHj26bV31WMKyHM6Aj3kbueq02Tlr/8 fzXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=MlQs798fD3HimILsVIH/RMuv643LnBHtKXQ4IW5SZaA=; b=gJECqrFgBc6HVrpNvFly+N8OZ/RM/rO8u+yV8nb78IFjZbanC+bbfjC5DUzIR9Em9i yy4MuC4ufIIe6XyTyiqBRQuGcBuo9LGx8HxuVdwhjN+O06Ads28qYeIwA6vCkYSldYbV AzALj11lDuloymlE5SrZeqIVh1a2vzQnbWLw0A0XY5m4M6U2ApHbdq2pARQgGGJDqUzl 6VOr4tTCTn641Vofa104LoL9GRHpaZws4k+DjgGOAio5+402qVb4WS7qvcvGnssRAN0Y MYci7g1IieT/nRARcAwM4qUJzDbh/uSWJ/rMOT5W9074C5NYvibQa6BXKpD0GSw4GIXU Axfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=eVPfCaXP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z86si13205785pfl.209.2018.12.11.03.04.31; Tue, 11 Dec 2018 03:04:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=eVPfCaXP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726367AbeLKLD2 (ORCPT + 99 others); Tue, 11 Dec 2018 06:03:28 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:36641 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbeLKLBm (ORCPT ); Tue, 11 Dec 2018 06:01:42 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id wBBB1C5j017210; Tue, 11 Dec 2018 20:01:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com wBBB1C5j017210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544526079; bh=MlQs798fD3HimILsVIH/RMuv643LnBHtKXQ4IW5SZaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eVPfCaXPPe7n1cnw+Knr9Zsq/PwgTsxnsnIO5JAD4eHK/rYj0WDkkaK40Kp0rxyIg muVXnZI3Ns4yE5N7y+ntHxoycTkegNmRZz5CTUT94jAAp2yvnGcq5TrcnyzZxCQJcX ri7UlEK76wP/224x5G01yaW9VCUadESFBq8+BVTZblzNPtA8h0fqzKVit+IP8Am1pg j97Yalx81TBg5Gdy+mDFFVqfCDo5ppNwo3WolTchGo36DFrg09UCYvzzPJ9ZvSWUYV 9Wngqbp0WRqENMXNSoV+Bw2tyKtPDNoZu6wLNZIDxP+FRXNj1CbY/4Bsz28e9W6aFu Lvx8vVgCKILNA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ulf Magnusson , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 08/27] kconfig: warn no new line at end of file Date: Tue, 11 Dec 2018 20:00:51 +0900 Message-Id: <1544526070-16690-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544526070-16690-1-git-send-email-yamada.masahiro@socionext.com> References: <1544526070-16690-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It would be nice to warn if a new line is missing at end of file. We could do this by checkpatch.pl for arbitrary files, but new line is rather essential as a statement terminator in Kconfig. The warning message looks like this: kernel/Kconfig.preempt:60:warning: no new line at end of file Currently, kernel/Kconfig.preempt is the only file with no new line at end of file. Fix it. I know there are some false negative cases. For example, no warning is displayed when the last line contains some whitespaces/comments, but no new line. Yet, this commit works well for most cases. Signed-off-by: Masahiro Yamada --- kernel/Kconfig.preempt | 2 +- scripts/kconfig/zconf.l | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt index cd16551..0fee5fe 100644 --- a/kernel/Kconfig.preempt +++ b/kernel/Kconfig.preempt @@ -57,4 +57,4 @@ config PREEMPT endchoice config PREEMPT_COUNT - bool \ No newline at end of file + bool diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 9038e97..5046d3c 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -78,6 +78,13 @@ static void warn_ignored_character(char chr) "%s:%d:warning: ignoring unsupported character '%c'\n", current_file->name, yylineno, chr); } + +static void warn_no_newline(void) +{ + fprintf(stderr, "%s:%d:warning: no new line at end of file\n", + current_file->name, yylineno); +} + %} n [A-Za-z0-9_-] @@ -261,6 +268,9 @@ n [A-Za-z0-9_-] <> { BEGIN(INITIAL); + if (prev_token != T_EOL && prev_token != T_HELPTEXT) + warn_no_newline(); + if (current_file) { zconf_endfile(); return T_EOL; -- 2.7.4