提交 95339b70 编写于 作者: T Tianjia Zhang 提交者: Thomas Bogendoerfer

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: NTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: NNathan Chancellor <nathan@kernel.org>
Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
上级 858779df
...@@ -318,7 +318,7 @@ enum cvmx_chip_types_enum { ...@@ -318,7 +318,7 @@ enum cvmx_chip_types_enum {
/* Functions to return string based on type */ /* Functions to return string based on type */
#define ENUM_BRD_TYPE_CASE(x) \ #define ENUM_BRD_TYPE_CASE(x) \
case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */
static inline const char *cvmx_board_type_to_string(enum static inline const char *cvmx_board_type_to_string(enum
cvmx_board_types_enum type) cvmx_board_types_enum type)
{ {
...@@ -410,7 +410,7 @@ static inline const char *cvmx_board_type_to_string(enum ...@@ -410,7 +410,7 @@ static inline const char *cvmx_board_type_to_string(enum
} }
#define ENUM_CHIP_TYPE_CASE(x) \ #define ENUM_CHIP_TYPE_CASE(x) \
case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */
static inline const char *cvmx_chip_type_to_string(enum static inline const char *cvmx_chip_type_to_string(enum
cvmx_chip_types_enum type) cvmx_chip_types_enum type)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册