summaryrefslogtreecommitdiff
path: root/.get_maintainer.ignore
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-09-06 12:19:24 +0300
committerDan Williams <dan.j.williams@intel.com>2018-10-17 23:56:54 +0300
commit9607871f37dc3e717639694b8d0dc738f2a68efc (patch)
treea794e8920d636d4ea86e2e9eb31b1b57f6c80167 /.get_maintainer.ignore
parentf110176633d74bbac1f80ab9b9c6b83ea3e1cc23 (diff)
downloadlinux-9607871f37dc3e717639694b8d0dc738f2a68efc.tar.xz
UAPI: ndctl: Fix g++-unsupported initialisation in headers
The following code in the linux/ndctl header file: static inline const char *nvdimm_bus_cmd_name(unsigned cmd) { static const char * const names[] = { [ND_CMD_ARS_CAP] = "ars_cap", [ND_CMD_ARS_START] = "ars_start", [ND_CMD_ARS_STATUS] = "ars_status", [ND_CMD_CLEAR_ERROR] = "clear_error", [ND_CMD_CALL] = "cmd_call", }; if (cmd < ARRAY_SIZE(names) && names[cmd]) return names[cmd]; return "unknown"; } is broken in a number of ways: (1) ARRAY_SIZE() is not generally defined. (2) g++ does not support "non-trivial" array initialisers fully yet. (3) Every file that calls this function will acquire a copy of names[]. The same goes for nvdimm_cmd_name(). Fix all three by converting to a switch statement where each case returns a string. That way if cmd is a constant, the compiler can trivially reduce it and, if not, the compiler can use a shared lookup table if it thinks that is more efficient. A better way would be to remove these functions and their arrays from the header entirely. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to '.get_maintainer.ignore')
0 files changed, 0 insertions, 0 deletions