fs/hugetlbfs/inode.c:1503:1: warning: ISO C90 forbids mixed declarations and code

From: kernel test robot
Date: Mon Nov 01 2021 - 11:33:01 EST


tree: https://github.com/0day-ci/linux/commits/UPDATE-20211101-194552/zhangyiru/mm-hugetlb-remove-mlock-ulimit-for-SHM_HUGETLB/20211009-094538
head: 00d28e7a2b1786c1ab3b63cc3abb4aca5c02fdfd
commit: 00d28e7a2b1786c1ab3b63cc3abb4aca5c02fdfd mm,hugetlb: remove mlock ulimit for SHM_HUGETLB
date: 4 hours ago
config: x86_64-randconfig-a012-20211101 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/00d28e7a2b1786c1ab3b63cc3abb4aca5c02fdfd
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20211101-194552/zhangyiru/mm-hugetlb-remove-mlock-ulimit-for-SHM_HUGETLB/20211009-094538
git checkout 00d28e7a2b1786c1ab3b63cc3abb4aca5c02fdfd
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

fs/hugetlbfs/inode.c:1448:14: error: conflicting types for 'hugetlb_file_setup'
1448 | struct file *hugetlb_file_setup(const char *name, size_t size,
| ^~~~~~~~~~~~~~~~~~
In file included from fs/hugetlbfs/inode.c:28:
include/linux/hugetlb.h:470:14: note: previous declaration of 'hugetlb_file_setup' was here
470 | struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct,
| ^~~~~~~~~~~~~~~~~~
fs/hugetlbfs/inode.c: In function 'hugetlb_file_setup':
fs/hugetlbfs/inode.c:1466:4: error: 'ucounts' undeclared (first use in this function)
1466 | *ucounts = current_ucounts();
| ^~~~~~~
fs/hugetlbfs/inode.c:1466:4: note: each undeclared identifier is reported only once for each function it appears in
fs/hugetlbfs/inode.c:1503:32: error: invalid storage class for function 'mount_one_hugetlbfs'
1503 | static struct vfsmount *__init mount_one_hugetlbfs(struct hstate *h)
| ^~~~~~~~~~~~~~~~~~~
>> fs/hugetlbfs/inode.c:1503:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
1503 | static struct vfsmount *__init mount_one_hugetlbfs(struct hstate *h)
| ^~~~~~
fs/hugetlbfs/inode.c:1523:19: error: invalid storage class for function 'init_hugetlbfs_fs'
1523 | static int __init init_hugetlbfs_fs(void)
| ^~~~~~~~~~~~~~~~~
In file included from include/asm-generic/bug.h:5,
from arch/x86/include/asm/bug.h:84,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from fs/hugetlbfs/inode.c:12:
include/linux/compiler.h:244:46: error: initializer element is not constant
244 | __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)&sym;
| ^
include/linux/init.h:236:2: note: in expansion of macro '__ADDRESSABLE'
236 | __ADDRESSABLE(fn)
| ^~~~~~~~~~~~~
include/linux/init.h:241:2: note: in expansion of macro '__define_initcall_stub'
241 | __define_initcall_stub(__stub, fn) \
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/init.h:254:2: note: in expansion of macro '____define_initcall'
254 | ____define_initcall(fn, \
| ^~~~~~~~~~~~~~~~~~~
include/linux/init.h:260:2: note: in expansion of macro '__unique_initcall'
260 | __unique_initcall(fn, id, __sec, __initcall_id(fn))
| ^~~~~~~~~~~~~~~~~
include/linux/init.h:262:35: note: in expansion of macro '___define_initcall'
262 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:288:27: note: in expansion of macro '__define_initcall'
288 | #define fs_initcall(fn) __define_initcall(fn, 5)
| ^~~~~~~~~~~~~~~~~
fs/hugetlbfs/inode.c:1579:1: note: in expansion of macro 'fs_initcall'
1579 | fs_initcall(init_hugetlbfs_fs)
| ^~~~~~~~~~~
In file included from include/linux/bits.h:22,
from include/linux/ratelimit_types.h:5,
from include/linux/printk.h:10,
from include/asm-generic/bug.h:22,
from arch/x86/include/asm/bug.h:84,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from fs/hugetlbfs/inode.c:12:
>> include/linux/build_bug.h:78:41: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~~~~~~~~~~~
include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ^~~~~~~~~~~~~~~
include/linux/init.h:246:2: note: in expansion of macro 'static_assert'
246 | static_assert(__same_type(initcall_t, &fn));
| ^~~~~~~~~~~~~
include/linux/init.h:254:2: note: in expansion of macro '____define_initcall'
254 | ____define_initcall(fn, \
| ^~~~~~~~~~~~~~~~~~~
include/linux/init.h:260:2: note: in expansion of macro '__unique_initcall'
260 | __unique_initcall(fn, id, __sec, __initcall_id(fn))
| ^~~~~~~~~~~~~~~~~
include/linux/init.h:262:35: note: in expansion of macro '___define_initcall'
262 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
| ^~~~~~~~~~~~~~~~~~
include/linux/init.h:288:27: note: in expansion of macro '__define_initcall'
288 | #define fs_initcall(fn) __define_initcall(fn, 5)
| ^~~~~~~~~~~~~~~~~
fs/hugetlbfs/inode.c:1579:1: note: in expansion of macro 'fs_initcall'
1579 | fs_initcall(init_hugetlbfs_fs)
| ^~~~~~~~~~~
fs/hugetlbfs/inode.c:1579:1: error: expected declaration or statement at end of input
fs/hugetlbfs/inode.c:1579: error: control reaches end of non-void function [-Werror=return-type]
1579 | fs_initcall(init_hugetlbfs_fs)
|
cc1: some warnings being treated as errors


vim +1503 fs/hugetlbfs/inode.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 1502
32021982a324dc David Howells 2018-11-01 @1503 static struct vfsmount *__init mount_one_hugetlbfs(struct hstate *h)
32021982a324dc David Howells 2018-11-01 1504 {
32021982a324dc David Howells 2018-11-01 1505 struct fs_context *fc;
32021982a324dc David Howells 2018-11-01 1506 struct vfsmount *mnt;
32021982a324dc David Howells 2018-11-01 1507
32021982a324dc David Howells 2018-11-01 1508 fc = fs_context_for_mount(&hugetlbfs_fs_type, SB_KERNMOUNT);
32021982a324dc David Howells 2018-11-01 1509 if (IS_ERR(fc)) {
32021982a324dc David Howells 2018-11-01 1510 mnt = ERR_CAST(fc);
32021982a324dc David Howells 2018-11-01 1511 } else {
32021982a324dc David Howells 2018-11-01 1512 struct hugetlbfs_fs_context *ctx = fc->fs_private;
32021982a324dc David Howells 2018-11-01 1513 ctx->hstate = h;
32021982a324dc David Howells 2018-11-01 1514 mnt = fc_mount(fc);
32021982a324dc David Howells 2018-11-01 1515 put_fs_context(fc);
32021982a324dc David Howells 2018-11-01 1516 }
32021982a324dc David Howells 2018-11-01 1517 if (IS_ERR(mnt))
a25fddced835ae Miaohe Lin 2021-02-24 1518 pr_err("Cannot mount internal hugetlbfs for page size %luK",
a25fddced835ae Miaohe Lin 2021-02-24 1519 huge_page_size(h) >> 10);
32021982a324dc David Howells 2018-11-01 1520 return mnt;
32021982a324dc David Howells 2018-11-01 1521 }
32021982a324dc David Howells 2018-11-01 1522

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip