Re: [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 15, 2021 at 11:32 AM Nathan Chancellor <nathan@xxxxxxxxxx> 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 <lkp@xxxxxxxxx>
> > >
> > > 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@xxxxxxxxx/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.
-- 
Thanks,
~Nick Desaulniers




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux