From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17878C48BDF for ; Tue, 15 Jun 2021 19:02:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5D456611EE for ; Tue, 15 Jun 2021 19:02:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D456611EE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E63176B0070; Tue, 15 Jun 2021 15:02:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E13756B0071; Tue, 15 Jun 2021 15:02:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC6D46B0072; Tue, 15 Jun 2021 15:02:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 9BFA26B0070 for ; Tue, 15 Jun 2021 15:02:30 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 779D7181AEF00 for ; Tue, 15 Jun 2021 19:02:28 +0000 (UTC) X-FDA: 78256879176.14.0BE4E7B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP id 92552420 for ; Tue, 15 Jun 2021 19:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=P5EDr/78c5JdpU+uOe7R3Zqx+CVflRHl3oyL60+EmTM=; b=hxTjCwqlm5ksRG5U7Ylcw71dVP 5x5f14dj+A9UXHU5oBxB0O0RPssCj8h4aR/VRXgG82MXcvMIoSpdD9GCRPzLYF6LSylTbsv08HELp 8aPxWUp2G/liQMU1OxzWebsq71oyJot2yFpbsuYFkJUsRD90ZtnragJFGg2FXMW/EezuYQxN1hxyH dd8G5g5zbbylf9oRJBfFNHdGXm53N+EzVX1yLHzkzjDYo1nK4Z22+yNcepW3HKjkIt4sB/6hio49m wt1qtL7zqbe4HR17avCPjjs25LTd6eWp/EKbs4Q3gykhNyjc3u7wi7X1r+o41QhmkZoLLlIXk6OwC zdgy7GFg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltEJv-0079jg-RL; Tue, 15 Jun 2021 19:01:59 +0000 Date: Tue, 15 Jun 2021 20:01:55 +0100 From: Matthew Wilcox To: Nick Desaulniers Cc: Nathan Chancellor , kernel test robot , Hugh Dickins , kbuild-all@lists.01.org, clang-built-linux , Linux Memory Management List , Andrew Morton Subject: Re: [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' Message-ID: References: <202106152328.Mh5S48hE-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hxTjCwql; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Stat-Signature: ik8qrxfs4jzfja79f8rx1hehrim47npz X-Rspamd-Queue-Id: 92552420 X-Rspamd-Server: rspam06 X-HE-Tag: 1623783734-77552 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 15, 2021 at 11:50:40AM -0700, Nick Desaulniers wrote: > On Tue, Jun 15, 2021 at 11:32 AM Nathan Chancellor wrote: > > > > On Tue, Jun 15, 2021 at 05:03:40PM +0100, Matthew Wilcox wrote: > > > On Tue, Jun 15, 2021 at 11:58:36PM +0800, kernel test robot wrote: > > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > > > > > If you fix the issue, kindly add following tag as appropriate > > > > Reported-by: kernel test robot > > > > > > > > All warnings (new ones prefixed by >>): > > > > > > > > >> mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' [-Wmissing-prototypes] > > > > pgoff_t hugetlb_basepage_index(struct page *page) > > > > > > So clang requires the prototype to still be in scope, while gcc doesn't. > > > Does one of our clangers want to file a bug about that? > > > > I see the exact same warning with GCC 11.1.0: > > > > $ curl -LSs https://lore.kernel.org/linux-mm/202106152328.Mh5S48hE-lkp@intel.com/2-a.bin | gzip -d > .config > > > > $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux- W=1 olddefconfig mm/hugetlb.c > > mm/hugetlb.c:1591:9: warning: no previous prototype for 'hugetlb_basepage_index' [-Wmissing-prototypes] > > 1591 | pgoff_t hugetlb_basepage_index(struct page *page) > > | ^~~~~~~~~~~~~~~~~~~~~~ > > Since this is a commonly recurring warning for W=1 builds, then this > function either should be declared as having static linkage if its > uses are local to the same file, or a prototype should be declared in > a header so that callers and callee agree on function signature. Oh, you haven't understood the problem. static inline int bar(void) { int foo(void); return foo(); } int foo(void) { return 1; } The prototype isn't _missing_. It's just no longer in scope. Since gcc and clang behave the same way here, we should adjust the source to make foo visible outside bar. But this is a case where both compilers are wrong.