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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 A3DC7C48BDF for ; Tue, 15 Jun 2021 23:37:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3267260FDB for ; Tue, 15 Jun 2021 23:37:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3267260FDB Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BCD1E6B006C; Tue, 15 Jun 2021 19:37:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7DA66B006E; Tue, 15 Jun 2021 19:37:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F6BA6B0070; Tue, 15 Jun 2021 19:37:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id 6CB716B006C for ; Tue, 15 Jun 2021 19:37:13 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 05FC8F048 for ; Tue, 15 Jun 2021 23:37:13 +0000 (UTC) X-FDA: 78257571546.13.9E1AC7D Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf13.hostedemail.com (Postfix) with ESMTP id 7E4F3E000255 for ; Tue, 15 Jun 2021 23:37:03 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id k11so787943qkk.1 for ; Tue, 15 Jun 2021 16:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=vr8Uam+PF/IjbdmKg/zkS8mw9SD6TDztuyw8DqboKBo=; b=txc3zMVlJXXUgwCZRtUJvUa2twDacXjh+3lMMTUTENQz56+HsMw0vgaFOA/j8RZM2s 539OxqiN0XmpuAq9/qO4PdXwdBWaMmdN16HIoqzHu8KxI1504IjuaBPrhrjfAaOxce8i LuvDXI9gucR4Odnit2njTIGzMPXNSnPd4fSbvVmAi/GCcbBfxHkrrMYsT2VJwWmE0LvV Qj7SQKMaYUxHdJmoKJBZEcZY+4bLpOeR2LNSYed+gCtG+XKGiatmxN9/2esOkt+OBgO/ oCOAfR7yM7v2KQbYAml77TfSlAKoFOg1S3i/qdZbIQrCw9As3DR6+WhJgr0r0STAhX8N 4/9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=vr8Uam+PF/IjbdmKg/zkS8mw9SD6TDztuyw8DqboKBo=; b=fruMRd46e1i5JcautglqOKhc9ge7GmGUgKT8Wri4q7kvtTMPAcdV965PwOnUbL6G/Q y2najt+fBMWJDUKzXWld94yXqDKPSOuhm6yY2b5MWrxMnTC/UN/ktEW5+CeWdJTeMQDn 0Or3IseQ3UGVSPN/+i3CxRTPyx0yI3vFMqI2xf4DIfgux0AytFW8dFVAwEUf53E+5E61 NLWO1AG5G6heyIXm8rlDXe4F3AQ0QV6XTEx32SB35M+AQCmPyHxT9BM2IUmUUzQrI7vm Fb4GBVcBpFLrRtrcxLdvg0Dwl+xK+2dxWu9bwZ2VgY5A9iHPw73+QcQmFIeUvWi0dTOj ikUw== X-Gm-Message-State: AOAM533MomsjRZjfk1FLJ2dLI8ZU1YJUL2Ej1AfqcCctyM83QKhvOZ/F P/oXKFMEx+JPVEaDgd3nqbfcaw== X-Google-Smtp-Source: ABdhPJzuwyCCs0tgvJcLxGlxU8VYLU90pEt4imcd2GY3ASsm/magQnNRkuAacUmHlDg2ZIx9sqjjYA== X-Received: by 2002:a37:a710:: with SMTP id q16mr2263880qke.15.1623800231793; Tue, 15 Jun 2021 16:37:11 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id z4sm176187qtj.68.2021.06.15.16.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 16:37:11 -0700 (PDT) Date: Tue, 15 Jun 2021 16:37:09 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Matthew Wilcox cc: Nick Desaulniers , 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' In-Reply-To: Message-ID: References: <202106152328.Mh5S48hE-lkp@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-2016070743-1623800231=:14856" Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=txc3zMVl; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf13.hostedemail.com: domain of hughd@google.com designates 209.85.222.175 as permitted sender) smtp.mailfrom=hughd@google.com X-Rspamd-Server: rspam02 X-Stat-Signature: kfnhca198ywra7xkwk43o4kg65ra5eii X-Rspamd-Queue-Id: 7E4F3E000255 X-HE-Tag: 1623800223-172238 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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-2016070743-1623800231=:14856 Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 15 Jun 2021, Matthew Wilcox wrote: > 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=3D$HOME/0day COMPILER=3Dclang make.= cross ARCH=3Darm64 > > > > > > > > > > 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 functi= on '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 doe= sn'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-lk= p@intel.com/2-a.bin | gzip -d > .config > > > > > > $ make -skj"$(nproc)" ARCH=3Darm64 CROSS_COMPILE=3Daarch64-linux- W= =3D1 olddefconfig mm/hugetlb.c > > > mm/hugetlb.c:1591:9: warning: no previous prototype for 'hugetlb_base= page_index' [-Wmissing-prototypes] > > > 1591 | pgoff_t hugetlb_basepage_index(struct page *page) > > > | ^~~~~~~~~~~~~~~~~~~~~~ > >=20 > > Since this is a commonly recurring warning for W=3D1 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. >=20 > Oh, you haven't understood the problem. >=20 > static inline int bar(void) > { > int foo(void); >=20 > return foo(); > } >=20 > int foo(void) { return 1; } >=20 > The prototype isn't _missing_. It's just no longer in scope. >=20 > 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. I guess I'd better start W=3D1-ing - not my habit before, sorry. I can't tell what's right or wrong for the compiler, but it sure is odd that if I add a bogus ", int flags" to hugetlb_basepage_index() in mm/hugetlb.c, then building with gcc (10) and W=3D1 says CC mm/hugetlb.o mm/hugetlb.c:1591:9: warning: no previous prototype for =A1hugetlb_basepage= _index=A2 [-Wmissing-prototypes] 1591 | pgoff_t hugetlb_basepage_index(struct page *page, int flags) | ^~~~~~~~~~~~~~~~~~~~~~ mm/hugetlb.c:1591:9: error: conflicting types for =A1hugetlb_basepage_index= =A2 In file included from mm/hugetlb.c:14: =2E/include/linux/pagemap.h:543:18: note: previous declaration of =A1hugetl= b_basepage_index=A2 was here 543 | extern pgoff_t hugetlb_basepage_index(struct page *page); | ^~~~~~~~~~~~~~~~~~~~~~ So, it manages to conflict with no previous prototype! (I didn't try clang with W=3D1, presumably similar.) Both gcc and clang with W=3D0 do issue the conflicting types error, as I hoped and assumed that they would when I put in the prototype. Oh well, thanks for moving it Matthew: whatever the rights and wrongs, neither of us want to be generating unnecessary noise. Hugh --0-2016070743-1623800231=:14856--