From patchwork Sun Feb 1 15:15:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 5757581 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 86888BF440 for ; Sun, 1 Feb 2015 20:00:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EC022022A for ; Sun, 1 Feb 2015 20:00:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4ED1B2020E for ; Sun, 1 Feb 2015 20:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754119AbbBAUA3 (ORCPT ); Sun, 1 Feb 2015 15:00:29 -0500 Received: from baptiste.telenet-ops.be ([195.130.132.51]:39264 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753940AbbBAUA3 (ORCPT ); Sun, 1 Feb 2015 15:00:29 -0500 Received: from mail.thalysnet.com ([212.123.27.210]) by baptiste.telenet-ops.be with bizsmtp id n80S1p00f4XzXFY0180Sfc; Sun, 01 Feb 2015 21:00:27 +0100 Received: from relay.thalys (unknown [10.1.13.2]) by mail.thalysnet.com (Postfix) with ESMTP id E49D120392; Sun, 1 Feb 2015 21:00:24 +0100 (CET) Received: from localhost.localdomain (unknown [192.168.101.198]) by relay.thalys (Postfix) with ESMTP id D393A63ED1; Sun, 1 Feb 2015 20:00:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.9/8.14.8) with ESMTP id t11FFRrk014769; Sun, 1 Feb 2015 16:15:27 +0100 Received: (from ydroneaud@localhost) by localhost.localdomain (8.14.9/8.14.9/Submit) id t11FFRLo014768; Sun, 1 Feb 2015 16:15:27 +0100 From: Yann Droneaud To: Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Yann Droneaud Subject: [PATCH] kbuild: support W=e to make build abort in case of warning Date: Sun, 1 Feb 2015 16:15:20 +0100 Message-Id: <1422803720-14723-1-git-send-email-ydroneaud@opteya.com> X-Mailer: git-send-email 2.1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to piss off^W^Whelp people trying to fix warnings, this patch introduces a new 'e' modifier to W= as a short hand for KCFLAGS+=-Werror" so that -Werror got added to the kernel (built-in) and modules' CFLAGS and makes the build abort when any warning is reported by the compiler. In the end, people not sane enough can do not so useful thing such as 'make W=123e'. Signed-off-by: Yann Droneaud --- Makefile | 1 + scripts/Makefile.extrawarn | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 6b69223a5267..42fd50d939e8 100644 --- a/Makefile +++ b/Makefile @@ -1338,6 +1338,7 @@ help: @echo ' 1: warnings which may be relevant and do not occur too often' @echo ' 2: warnings which occur quite often but may still be relevant' @echo ' 3: more obscure warnings, can most likely be ignored' + @echo ' e: warnings are being treated as errors' @echo ' Multiple levels can be combined with W=12 or W=123' @echo '' @echo 'Execute "make" or "make all" to build all targets marked with [*] ' diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index f734033af219..798796e078d9 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -5,6 +5,7 @@ # W=1 - warnings that may be relevant and does not occur too often # W=2 - warnings that occur quite often but may still be relevant # W=3 - the more obscure warnings, can most likely be ignored +# W=e - warnings are being treated as errors # # $(call cc-option, -W...) handles gcc -W.. options which # are not supported by all versions of the compiler @@ -45,9 +46,12 @@ warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) warning-3 += $(call cc-option, -Wvla) +warning-e := -Werror + warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) +warning += $(warning-$(findstring e, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) ifeq ("$(strip $(warning))","") $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)