From patchwork Fri Sep 13 21:51:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 2892471 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 12A96BFF05 for ; Fri, 13 Sep 2013 21:51:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1984F20200 for ; Fri, 13 Sep 2013 21:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9117320113 for ; Fri, 13 Sep 2013 21:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754981Ab3IMVvo (ORCPT ); Fri, 13 Sep 2013 17:51:44 -0400 Received: from mail-qc0-f202.google.com ([209.85.216.202]:33862 "EHLO mail-qc0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755528Ab3IMVvm (ORCPT ); Fri, 13 Sep 2013 17:51:42 -0400 Received: by mail-qc0-f202.google.com with SMTP id r5so228544qcx.1 for ; Fri, 13 Sep 2013 14:51:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:cc:from:date:mime-version :content-type:content-transfer-encoding:message-id; bh=T/uCBWnNHfdajLMbRrjF2hmXg+C/QxdqG3N+E4cCHH8=; b=hDiaNwHEIgj5zDaZm3LUnIWrtc1KgnYq4aGfNpYP52J+qriEb7QfcBvNAVokkGrgFS ZlAcSoVViSeuwvJAiK1f6yuYWlCy6ql5Xd64MKBg9H8Q+x1FiIBge5Ieqv7oLppGFHCc ld1vqrF5AKwVKaJRPU0ypfaB6M1R+KamVnicfIWhX1Zwb2MfGLn0v/Qlyl2Kg7DpQAQE kDX0II33Ox770HVkfNQKn/M+I9yDI8Y+E71GnuK8GP0qjNYM1pXI22qS8+oBSkTP9n8i aBEuDaBQD3yuLRdnbVokDaUNStl2zPJwGTAHDHX4xrTz3ZbakbpPmAmPBH9kkeC9Rq+X 8/xg== X-Gm-Message-State: ALoCoQk6TCsY5XGtnqlrmKiUfXqoBj9YGl6eq/kRN/ocG0V7DwqZzMk8vPHroV3f4yW0qhEhe/uB X-Received: by 10.236.36.39 with SMTP id v27mr6052839yha.5.1379109101793; Fri, 13 Sep 2013 14:51:41 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id z45si784940yha.7.1969.12.31.16.00.00 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Fri, 13 Sep 2013 14:51:41 -0700 (PDT) Received: from localhost.localdomain (akpm3.mtv.corp.google.com [172.17.131.127]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 43D1931C1EA; Fri, 13 Sep 2013 14:51:41 -0700 (PDT) Subject: [patch 2/2] ./Makefile: enable -Werror=implicit-int and -Werror=strict-prototypes by default To: mmarek@suse.cz Cc: linux-kbuild@vger.kernel.org, akpm@linux-foundation.org, slyfox@gentoo.org, geert@linux-m68k.org From: akpm@linux-foundation.org Date: Fri, 13 Sep 2013 14:51:40 -0700 MIME-Version: 1.0 Message-Id: <20130913215141.43D1931C1EA@corp2gmr1-1.hot.corp.google.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Sergei Trofimovich Subject: ./Makefile: enable -Werror=implicit-int and -Werror=strict-prototypes by default The common error found 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. [akpm@linux-foundation.org: fix typos in comments] Signed-off-by: Sergei Trofimovich Cc: Michal Marek Cc: Geert Uytterhoeven Signed-off-by: Andrew Morton --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff -puN Makefile~makefile-enable-werror=implicit-int-and-werror=strict-prototypes-by-default Makefile --- a/Makefile~makefile-enable-werror=implicit-int-and-werror=strict-prototypes-by-default +++ a/Makefile @@ -659,6 +659,12 @@ KBUILD_CFLAGS += $(call cc-option,-fno-s # conserve stack if available KBUILD_CFLAGS += $(call cc-option,-fconserve-stack) +# disallow errors like 'EXPORT_GPL(foo);' with missing header +KBUILD_CFLAGS += $(call cc-option,-Werror=implicit-int) + +# require functions to have arguments 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)