[mingo-tip:sched/headers 1105/2380] arch/powerpc/include/asm/inst.h:143:17: error: implicit declaration of function 'sprintf'

From: kernel test robot
Date: Sun Jan 09 2022 - 17:44:06 EST


tree: git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git sched/headers
head: 351bfbf7f1e8dce84b605c8007c98dd603c4ca4d
commit: cda4a13524f2ac766110f33d7851a490d39accd4 [1105/2380] headers/deps: Add header dependencies to .c files: <linux/kernel.h>
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20220110/202201100628.S5iEUAdr-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 11.2.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://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git/commit/?id=cda4a13524f2ac766110f33d7851a490d39accd4
git remote add mingo-tip git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git
git fetch --no-tags mingo-tip sched/headers
git checkout cda4a13524f2ac766110f33d7851a490d39accd4
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc prepare

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

Note: the mingo-tip/sched/headers HEAD 351bfbf7f1e8dce84b605c8007c98dd603c4ca4d builds fine.
It only hurts bisectability.

All error/warnings (new ones prefixed by >>):

In file included from arch/powerpc/include/asm/hw_breakpoint.h:12,
from arch/powerpc/include/asm/processor.h:43,
from arch/powerpc/include/asm/thread_info.h:40,
from include/linux/thread_info.h:61,
from arch/powerpc/include/asm/ptrace.h:323,
from arch/powerpc/include/asm/hw_irq.h:12,
from arch/powerpc/include/asm/irqflags.h:12,
from include/linux/irqflags.h:16,
from include/asm-generic/cmpxchg-local.h:6,
from arch/powerpc/include/asm/cmpxchg.h:526,
from arch/powerpc/include/asm/atomic.h:11,
from include/linux/atomic.h:7,
from include/linux/atomic_api.h:1,
from include/linux/jump_label.h:76,
from include/linux/dynamic_debug.h:6,
from include/linux/printk.h:559,
from include/linux/kernel.h:20,
from kernel/bounds.c:10:
arch/powerpc/include/asm/cpu_has_feature.h:21:31: error: array type has incomplete element type 'struct static_key_true'
21 | extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS];
| ^~~~~~~~~~~~~~~~
arch/powerpc/include/asm/cpu_has_feature.h: In function 'cpu_has_feature':
arch/powerpc/include/asm/cpu_has_feature.h:32:14: error: 'static_key_initialized' undeclared (first use in this function)
32 | if (!static_key_initialized) {
| ^~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/cpu_has_feature.h:32:14: note: each undeclared identifier is reported only once for each function it appears in
arch/powerpc/include/asm/cpu_has_feature.h:46:16: error: implicit declaration of function 'static_branch_likely' [-Werror=implicit-function-declaration]
46 | return static_branch_likely(&cpu_feature_keys[i]);
| ^~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/cpu_has_feature.h:25:13: warning: variable 'i' set but not used [-Wunused-but-set-variable]
25 | int i;
| ^
In file included from arch/powerpc/include/asm/hw_breakpoint.h:13,
from arch/powerpc/include/asm/processor.h:43,
from arch/powerpc/include/asm/thread_info.h:40,
from include/linux/thread_info.h:61,
from arch/powerpc/include/asm/ptrace.h:323,
from arch/powerpc/include/asm/hw_irq.h:12,
from arch/powerpc/include/asm/irqflags.h:12,
from include/linux/irqflags.h:16,
from include/asm-generic/cmpxchg-local.h:6,
from arch/powerpc/include/asm/cmpxchg.h:526,
from arch/powerpc/include/asm/atomic.h:11,
from include/linux/atomic.h:7,
from include/linux/atomic_api.h:1,
from include/linux/jump_label.h:76,
from include/linux/dynamic_debug.h:6,
from include/linux/printk.h:559,
from include/linux/kernel.h:20,
from kernel/bounds.c:10:
arch/powerpc/include/asm/inst.h: In function '__ppc_inst_as_str':
>> arch/powerpc/include/asm/inst.h:143:17: error: implicit declaration of function 'sprintf' [-Werror=implicit-function-declaration]
143 | sprintf(str, "%08x %08x", ppc_inst_val(x), ppc_inst_suffix(x));
| ^~~~~~~
arch/powerpc/include/asm/inst.h:1:1: note: include '<stdio.h>' or provide a declaration of 'sprintf'
+++ |+#include <stdio.h>
1 | /* SPDX-License-Identifier: GPL-2.0-or-later */
>> arch/powerpc/include/asm/inst.h:143:17: warning: incompatible implicit declaration of built-in function 'sprintf' [-Wbuiltin-declaration-mismatch]
143 | sprintf(str, "%08x %08x", ppc_inst_val(x), ppc_inst_suffix(x));
| ^~~~~~~
arch/powerpc/include/asm/inst.h:143:17: note: include '<stdio.h>' or provide a declaration of 'sprintf'
In file included from arch/powerpc/include/asm/ptrace.h:323,
from arch/powerpc/include/asm/hw_irq.h:12,
from arch/powerpc/include/asm/irqflags.h:12,
from include/linux/irqflags.h:16,
from include/asm-generic/cmpxchg-local.h:6,
from arch/powerpc/include/asm/cmpxchg.h:526,
from arch/powerpc/include/asm/atomic.h:11,
from include/linux/atomic.h:7,
from include/linux/atomic_api.h:1,
from include/linux/jump_label.h:76,
from include/linux/dynamic_debug.h:6,
from include/linux/printk.h:559,
from include/linux/kernel.h:20,
from kernel/bounds.c:10:
arch/powerpc/include/asm/thread_info.h: In function 'clear_thread_local_flags':
include/linux/thread_info.h:26:32: error: implicit declaration of function 'task_thread_info'; did you mean 'current_thread_info'? [-Werror=implicit-function-declaration]
26 | # define current_thread_info() task_thread_info(current)
| ^~~~~~~~~~~~~~~~
arch/powerpc/include/asm/thread_info.h:159:34: note: in expansion of macro 'current_thread_info'
159 | struct thread_info *ti = current_thread_info();
| ^~~~~~~~~~~~~~~~~~~
include/linux/thread_info.h:26:32: warning: initialization of 'struct thread_info *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
26 | # define current_thread_info() task_thread_info(current)
| ^~~~~~~~~~~~~~~~
arch/powerpc/include/asm/thread_info.h:159:34: note: in expansion of macro 'current_thread_info'
159 | struct thread_info *ti = current_thread_info();
| ^~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/thread_info.h: In function 'test_thread_local_flags':
include/linux/thread_info.h:26:32: warning: initialization of 'struct thread_info *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
26 | # define current_thread_info() task_thread_info(current)
| ^~~~~~~~~~~~~~~~
arch/powerpc/include/asm/thread_info.h:165:34: note: in expansion of macro 'current_thread_info'
165 | struct thread_info *ti = current_thread_info();
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:121: kernel/bounds.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1197: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:219: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.


vim +/sprintf +143 arch/powerpc/include/asm/inst.h

50428fdc53ba48 Jordan Niethe 2020-06-02 139
50428fdc53ba48 Jordan Niethe 2020-06-02 140 static inline char *__ppc_inst_as_str(char str[PPC_INST_STR_LEN], struct ppc_inst x)
50428fdc53ba48 Jordan Niethe 2020-06-02 141 {
50428fdc53ba48 Jordan Niethe 2020-06-02 142 if (ppc_inst_prefixed(x))
50428fdc53ba48 Jordan Niethe 2020-06-02 @143 sprintf(str, "%08x %08x", ppc_inst_val(x), ppc_inst_suffix(x));
50428fdc53ba48 Jordan Niethe 2020-06-02 144 else
50428fdc53ba48 Jordan Niethe 2020-06-02 145 sprintf(str, "%08x", ppc_inst_val(x));
50428fdc53ba48 Jordan Niethe 2020-06-02 146
50428fdc53ba48 Jordan Niethe 2020-06-02 147 return str;
50428fdc53ba48 Jordan Niethe 2020-06-02 148 }
50428fdc53ba48 Jordan Niethe 2020-06-02 149

:::::: The code at line 143 was first introduced by commit
:::::: 50428fdc53ba48f6936b10dfdc0d644972403908 powerpc: Add a ppc_inst_as_str() helper

:::::: TO: Jordan Niethe <jniethe5@xxxxxxxxx>
:::::: CC: Michael Ellerman <mpe@xxxxxxxxxxxxxx>

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