Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Octeon: Fix build errors using clang

A large number of the following errors is reported when compiling
with clang:

cvmx-bootinfo.h:326:3: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cvmx-bootinfo.h:321:20: note: expanded from macro 'ENUM_BRD_TYPE_CASE'
case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */
~~~^~~~
cvmx-bootinfo.h:326:3: note: use array indexing to silence this warning
cvmx-bootinfo.h:321:20: note: expanded from macro 'ENUM_BRD_TYPE_CASE'
case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */
^

Follow the prompts to use the address operator '&' to fix this error.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Tianjia Zhang and committed by
Thomas Bogendoerfer
95339b70 858779df

+2 -2
+2 -2
arch/mips/include/asm/octeon/cvmx-bootinfo.h
··· 318 318 319 319 /* Functions to return string based on type */ 320 320 #define ENUM_BRD_TYPE_CASE(x) \ 321 - case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ 321 + case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ 322 322 static inline const char *cvmx_board_type_to_string(enum 323 323 cvmx_board_types_enum type) 324 324 { ··· 410 410 } 411 411 412 412 #define ENUM_CHIP_TYPE_CASE(x) \ 413 - case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ 413 + case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ 414 414 static inline const char *cvmx_chip_type_to_string(enum 415 415 cvmx_chip_types_enum type) 416 416 {