Wsometimes-uninitialized warning
Quoted 25 lines · Sodagudi Prasad
Hi All,
I have observed compile time issues with modules incremental compilation using clang.
I referred to following clang documentation about this warning.
http://releases.llvm.org/3.2/tools/clang/docs/ReleaseNotes.htmlBut in kernel code,
PERCPU_OPmacro default case is not reachable to throw this -Wsometimes-uninitialized warning.BUILD_BUG()is getting used for the default cases of thePERCPU_OPmacro. Have you observed -Wsometimes-uninitialized warnings with clang when compiling 4.14.6?/arch/arm64/include/asm/percpu.h:102:1: note: variable 'ret' is declared here
/arch/arm64/include/asm/percpu.h:52:2: note: expanded from macro 'PERCPU_OP'unsigned long loop, ret; \ ^/arch/arm64/include/asm/percpu.h:103:1: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
PERCPU_OP(and, and)
^~~~~~~~~~~~~~~~~~~
/arch/arm64/include/asm/percpu.h:95:2: note: expanded from macro 'PERCPU_OP'
Quoted 4 lines
default: \Do you have any suggestions/comments?
FWIW, I had a go at rewriting that file last week:
With that, the switch statement disappears altogether.
Will