From: Yafang Shao <laoar.shao@gmail.com>
To: lkp@intel.com
Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
cgroups@vger.kernel.org, daniel@iogearbox.net,
hannes@cmpxchg.org, haoluo@google.com, john.fastabend@gmail.com,
jolsa@kernel.org, kpsingh@kernel.org, laoar.shao@gmail.com,
lizefan.x@bytedance.com, longman@redhat.com,
martin.lau@linux.dev, mkoutny@suse.com,
oe-kbuild-all@lists.linux.dev, oliver.sang@intel.com,
sdf@google.com, sinquersw@gmail.com, song@kernel.org,
tj@kernel.org, yonghong.song@linux.dev, yosryahmed@google.com,
Arnd Bergmann <arnd@arndb.de>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>
Subject: [PATCH v2 bpf-next] compiler-gcc: Suppress -Wmissing-prototypes warning for all supported GCC
Date: Mon, 6 Nov 2023 03:18:02 +0000 [thread overview]
Message-ID: <20231106031802.4188-1-laoar.shao@gmail.com> (raw)
In-Reply-To: <202311031651.A7crZEur-lkp@intel.com>
The kernel supports a minimum GCC version of 5.1.0 for building. However,
the "__diag_ignore_all" directive only suppresses the
"-Wmissing-prototypes" warning for GCC versions >= 8.0.0. As a result, when
building the kernel with older GCC versions, warnings may be triggered. The
example below illustrates the warnings reported by the kernel test robot
using GCC 7.5.0:
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
All warnings (new ones prefixed by >>):
kernel/bpf/helpers.c:1893:19: warning: no previous prototype for 'bpf_obj_new_impl' [-Wmissing-prototypes]
__bpf_kfunc void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
^~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1907:19: warning: no previous prototype for 'bpf_percpu_obj_new_impl' [-Wmissing-prototypes]
__bpf_kfunc void *bpf_percpu_obj_new_impl(u64 local_type_id__k, void *meta__ign)
[...]
To address this, we should also suppress the "-Wmissing-prototypes" warning
for older GCC versions. "#pragma GCC diagnostic push" is supported as
of GCC 4.6, and both "-Wmissing-prototypes" and "-Wmissing-declarations"
are supported for all the GCC versions that we currently support.
Therefore, it is reasonable to suppress these warnings for all supported
GCC versions.
With this adjustment, it's important to note that after implementing
"__diag_ignore_all", it will effectively suppress warnings for all the
supported GCC versions.
In the future, if you wish to suppress warnings that are only supported on
higher GCC versions, it is advisable to explicitly use "__diag_ignore" to
specify the GCC version you are targeting.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311031651.A7crZEur-lkp@intel.com/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
include/linux/compiler-gcc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 7af9e34..80918bd 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -138,7 +138,7 @@
#endif
#define __diag_ignore_all(option, comment) \
- __diag_GCC(8, ignore, option)
+ __diag(__diag_GCC_ignore option)
/*
* Prior to 9.1, -Wno-alloc-size-larger-than (and therefore the "alloc_size"
--
1.8.3.1
next prev parent reply other threads:[~2023-11-06 3:18 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-29 6:14 [PATCH v3 bpf-next 00/11] bpf, cgroup: Add BPF support for cgroup1 hierarchy Yafang Shao
2023-10-29 6:14 ` [PATCH v3 bpf-next 01/11] cgroup: Remove unnecessary list_empty() Yafang Shao
2023-11-09 21:09 ` Tejun Heo
2023-10-29 6:14 ` [PATCH v3 bpf-next 02/11] cgroup: Make operations on the cgroup root_list RCU safe Yafang Shao
2023-11-09 21:19 ` Tejun Heo
2023-10-29 6:14 ` [PATCH v3 bpf-next 03/11] cgroup: Eliminate the need for cgroup_mutex in proc_cgroup_show() Yafang Shao
2023-11-09 21:20 ` Tejun Heo
2023-10-29 6:14 ` [PATCH v3 bpf-next 04/11] cgroup: Add annotation for holding namespace_sem in current_cgns_cgroup_from_root() Yafang Shao
2023-11-09 21:22 ` Tejun Heo
2023-10-29 6:14 ` [PATCH v3 bpf-next 05/11] cgroup: Add a new helper for cgroup1 hierarchy Yafang Shao
2023-11-09 9:33 ` Hou Tao
2023-11-09 21:27 ` Tejun Heo
2023-11-09 23:30 ` Tejun Heo
2023-11-10 2:37 ` Yafang Shao
2023-10-29 6:14 ` [PATCH v3 bpf-next 06/11] bpf: Add a new kfunc " Yafang Shao
2023-10-30 9:00 ` kernel test robot
2023-10-30 11:35 ` Yafang Shao
2023-10-30 13:59 ` Jiri Olsa
2023-10-31 2:40 ` Yafang Shao
2023-10-31 4:22 ` David Marchevsky
2023-11-03 8:18 ` kernel test robot
2023-11-03 8:49 ` Yafang Shao
2023-11-05 6:22 ` [PATCH bpf-next] compiler-gcc: Ignore -Wmissing-prototypes warning for older GCC Yafang Shao
2023-11-05 8:24 ` Arnd Bergmann
2023-11-05 11:54 ` Yafang Shao
2023-11-05 13:01 ` Arnd Bergmann
2023-11-05 13:50 ` Yafang Shao
2023-11-06 3:18 ` Yafang Shao [this message]
2023-11-09 18:23 ` [PATCH v2 bpf-next] compiler-gcc: Suppress -Wmissing-prototypes warning for all supported GCC Alexei Starovoitov
2023-11-10 6:34 ` Arnd Bergmann
2023-11-10 7:48 ` Yafang Shao
2023-11-10 16:00 ` patchwork-bot+netdevbpf
2023-11-09 21:29 ` [PATCH v3 bpf-next 06/11] bpf: Add a new kfunc for cgroup1 hierarchy Tejun Heo
2023-10-29 6:14 ` [PATCH v3 bpf-next 07/11] selftests/bpf: Fix issues in setup_classid_environment() Yafang Shao
2023-10-29 6:14 ` [PATCH v3 bpf-next 08/11] selftests/bpf: Add parallel support for classid Yafang Shao
2023-10-29 6:14 ` [PATCH v3 bpf-next 09/11] selftests/bpf: Add a new cgroup helper get_classid_cgroup_id() Yafang Shao
2023-10-29 6:14 ` [PATCH v3 bpf-next 10/11] selftests/bpf: Add a new cgroup helper get_cgroup_hierarchy_id() Yafang Shao
2023-11-09 21:32 ` Tejun Heo
2023-11-10 2:40 ` Yafang Shao
2023-10-29 6:14 ` [PATCH v3 bpf-next 11/11] selftests/bpf: Add selftests for cgroup1 hierarchy Yafang Shao
2023-11-09 21:36 ` [PATCH v3 bpf-next 00/11] bpf, cgroup: Add BPF support " Tejun Heo
2023-11-09 23:06 ` Alexei Starovoitov
2023-11-09 23:28 ` Tejun Heo
2023-11-09 23:35 ` Alexei Starovoitov
2023-11-10 6:04 ` Yafang Shao
2023-11-10 17:05 ` Alexei Starovoitov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231106031802.4188-1-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=andrii@kernel.org \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hannes@cmpxchg.org \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=lkp@intel.com \
--cc=longman@redhat.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mkoutny@suse.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=sdf@google.com \
--cc=sinquersw@gmail.com \
--cc=song@kernel.org \
--cc=tj@kernel.org \
--cc=yonghong.song@linux.dev \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox