Add missing <string.h> include for strcmp.
Clang 16 makes -Wimplicit-function-declaration an error by default. Unfortunately, out of tree modules may use this in configure scripts, which means failure might cause silent miscompilation or misconfiguration.
For more information, see LWN.net [0] or LLVM's Discourse [1], gentoo-dev@ [2], or the (new) c-std-porting mailing list [3].
[0] https://lwn.net/Articles/913505/ [1] https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-i... [2] https://archives.gentoo.org/gentoo-dev/message/dd9f2d3082b8b6f8dfbccb0639e6e... [3] hosted at lists.linux.dev.
Cc: Andrew Morton akpm@linux-foundation.org Cc: trivial@kernel.org Cc: stable@vger.kernel.org Signed-off-by: Sam James sam@gentoo.org --- include/linux/license.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/linux/license.h b/include/linux/license.h index 7cce390f120b..1c0f28904ed0 100644 --- a/include/linux/license.h +++ b/include/linux/license.h @@ -2,6 +2,8 @@ #ifndef __LICENSE_H #define __LICENSE_H
+#include <string.h> + static inline int license_is_gpl_compatible(const char *license) { return (strcmp(license, "GPL") == 0
On 16 Nov 2022, at 18:26, Sam James sam@gentoo.org wrote:
Add missing <string.h> include for strcmp.
Clang 16 makes -Wimplicit-function-declaration an error by default. Unfortunately, out of tree modules may use this in configure scripts, which means failure might cause silent miscompilation or misconfiguration.
For more information, see LWN.net [0] or LLVM's Discourse [1], gentoo-dev@ [2], or the (new) c-std-porting mailing list [3].
[0] https://lwn.net/Articles/913505/ [1] https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-i... [2] https://archives.gentoo.org/gentoo-dev/message/dd9f2d3082b8b6f8dfbccb0639e6e... [3] hosted at lists.linux.dev.
Cc: Andrew Morton akpm@linux-foundation.org Cc: trivial@kernel.org Cc: stable@vger.kernel.org Signed-off-by: Sam James sam@gentoo.org
include/linux/license.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/linux/license.h b/include/linux/license.h index 7cce390f120b..1c0f28904ed0 100644 --- a/include/linux/license.h +++ b/include/linux/license.h @@ -2,6 +2,8 @@ #ifndef __LICENSE_H #define __LICENSE_H
+#include <string.h>
Andrew's added this to his tree with the following fixup (duh!): ``` -#include <string.h> +#include <linux/string.h> ```
Best, sam
Hi Sam,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on akpm-mm/mm-everything] [also build test ERROR on linus/master v6.1-rc5 next-20221116] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sam-James/kbuild-Fix-Wimplici... base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20221116182634.2823136-1-sam%40gentoo.org patch subject: [PATCH] kbuild: Fix -Wimplicit-function-declaration in license_is_gpl_compatible config: arc-defconfig compiler: arc-elf-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/f9de22a17ac9a7c6290945983b3362... git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Sam-James/kbuild-Fix-Wimplicit-function-declaration-in-license_is_gpl_compatible/20221117-022718 git checkout f9de22a17ac9a7c6290945983b336296c3d4766b # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot lkp@intel.com
All errors (new ones prefixed by >>):
In file included from kernel/module/main.c:43:
include/linux/license.h:5:10: fatal error: string.h: No such file or directory
5 | #include <string.h> | ^~~~~~~~~~ compilation terminated.
vim +5 include/linux/license.h
4
5 #include <string.h>
6
Hi Sam,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on akpm-mm/mm-everything] [also build test ERROR on linus/master v6.1-rc5 next-20221116] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sam-James/kbuild-Fix-Wimplici... base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20221116182634.2823136-1-sam%40gentoo.org patch subject: [PATCH] kbuild: Fix -Wimplicit-function-declaration in license_is_gpl_compatible config: mips-randconfig-r024-20221117 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project bbe6bd724a6335e497c7edaed191d37a828d0390) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install mips cross compiling tool for clang build # apt-get install binutils-mipsel-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/f9de22a17ac9a7c6290945983b3362... git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Sam-James/kbuild-Fix-Wimplicit-function-declaration-in-license_is_gpl_compatible/20221117-022718 git checkout f9de22a17ac9a7c6290945983b336296c3d4766b # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash kernel/
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot lkp@intel.com
All errors (new ones prefixed by >>):
In file included from kernel/bpf/syscall.c:20:
include/linux/license.h:5:10: error: 'string.h' file not found with <angled> include; use "quotes" instead
#include <string.h> ^~~~~~~~~~ "string.h" 1 error generated.
vim +5 include/linux/license.h
4
5 #include <string.h>
6
linux-stable-mirror@lists.linaro.org