From patchwork Fri Aug 23 17:55:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Trofimovich X-Patchwork-Id: 2848963 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 82C59BF546 for ; Fri, 23 Aug 2013 17:59:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 76C61204CD for ; Fri, 23 Aug 2013 17:59:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41912204B9 for ; Fri, 23 Aug 2013 17:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755794Ab3HWR7m (ORCPT ); Fri, 23 Aug 2013 13:59:42 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:58704 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755730Ab3HWR7l (ORCPT ); Fri, 23 Aug 2013 13:59:41 -0400 Received: from sf.home (unknown [178.124.122.208]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: slyfox) by smtp.gentoo.org (Postfix) with ESMTPSA id 3338833ECC0; Fri, 23 Aug 2013 17:59:41 +0000 (UTC) Received: by sf.home (Postfix, from userid 1000) id 18D0C90589BD; Fri, 23 Aug 2013 20:56:26 +0300 (FET) From: Sergei Trofimovich To: linux-kernel@vger.kernel.org Cc: Sergei Trofimovich , Michal Marek , linux-kbuild@vger.kernel.org, Andrew Morton , Geert Uytterhoeven Subject: [PATCH v3] Makefile: enable -Werror=implicit-int and -Werror=strict-prototypes by default Date: Fri, 23 Aug 2013 20:55:33 +0300 Message-Id: <1377280533-15349-1-git-send-email-slyfox@gentoo.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The common error fount in forward-ported/backported patches is missing headers. One recent example (files and function names are mangled): void foo(){} EXPORT_SYMBOL(foo); gave only warning foo.c:12345678:5: warning: function declaration isn't a prototype [-Wstrict-prototypes] void foo(){} ^ foo.c:12345679:5: warning: data definition has no type or storage class [enabled by default] EXPORT_SYMBOL(foo); foo.c:12345679:5: warning: type defaults to 'int' in declaration of 'EXORT_SYMBOL' [-Werror=implicit-int] Now it's a fatal error. Tested on x86_64 allyesconfig. Signed-off-by: Sergei Trofimovich Cc: Michal Marek Cc: linux-kbuild@vger.kernel.org Cc: Andrew Morton Cc: Geert Uytterhoeven --- Makefile | 6 +++++++ 1 file changed, 6 insertions(+) Change since v2: - moved CFLAGS checks lower to catch $(CROSS) case as suggested by Geert - added comments as other warning options do Change since v1: - use 'cc-option' to respect old gccs - fix typos. Thanks to Oleg Verych diff --git a/Makefile b/Makefile index a5a55f4..f5f36e1 100644 --- a/Makefile +++ b/Makefile @@ -659,6 +660,12 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) # conserve stack if available KBUILD_CFLAGS += $(call cc-option,-fconserve-stack) +# disallog errors like 'EXPORT_GPL(foo);' with missing header +KBUILD_CFLAGS += $(call cc-option,-Werror=implicit-int) + +# require functions to have argumens in prototypes, not empty 'int foo()' +KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes) + # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D)