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

tools lib subcmd: Fix missing member name

This patch adds missing member names to struct initializations.

Although in C99 for struct S {int x, int y} two init codes struct S s =
{.x = (a), (b)} and struct S s = {.x = (a), .y = (b)} are the same, it
is better to explicitly write .y (.argh in this patch) for readability
and robustness against language/compiler evolutions.

Signed-off-by: Soramichi Akiyama <akiyama@m.soramichi.jp>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20170113215623.32fb1ac2d862af0048c30fe6@m.soramichi.jp
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Soramichi AKIYAMA and committed by
Arnaldo Carvalho de Melo
f7ee6595 2484c4c5

+9 -9
+9 -9
tools/lib/subcmd/parse-options.h
··· 133 133 #define OPT_UINTEGER(s, l, v, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) } 134 134 #define OPT_LONG(s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) } 135 135 #define OPT_U64(s, l, v, h) { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) } 136 - #define OPT_STRING(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) } 136 + #define OPT_STRING(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), .argh = (a), .help = (h) } 137 137 #define OPT_STRING_OPTARG(s, l, v, a, h, d) \ 138 138 { .type = OPTION_STRING, .short_name = (s), .long_name = (l), \ 139 - .value = check_vtype(v, const char **), (a), .help = (h), \ 139 + .value = check_vtype(v, const char **), .argh =(a), .help = (h), \ 140 140 .flags = PARSE_OPT_OPTARG, .defval = (intptr_t)(d) } 141 141 #define OPT_STRING_OPTARG_SET(s, l, v, os, a, h, d) \ 142 142 { .type = OPTION_STRING, .short_name = (s), .long_name = (l), \ 143 - .value = check_vtype(v, const char **), (a), .help = (h), \ 143 + .value = check_vtype(v, const char **), .argh = (a), .help = (h), \ 144 144 .flags = PARSE_OPT_OPTARG, .defval = (intptr_t)(d), \ 145 145 .set = check_vtype(os, bool *)} 146 - #define OPT_STRING_NOEMPTY(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h), .flags = PARSE_OPT_NOEMPTY} 146 + #define OPT_STRING_NOEMPTY(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), .argh = (a), .help = (h), .flags = PARSE_OPT_NOEMPTY} 147 147 #define OPT_DATE(s, l, v, h) \ 148 148 { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb } 149 149 #define OPT_CALLBACK(s, l, v, a, h, f) \ 150 - { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f) } 150 + { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f) } 151 151 #define OPT_CALLBACK_NOOPT(s, l, v, a, h, f) \ 152 - { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f), .flags = PARSE_OPT_NOARG } 152 + { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f), .flags = PARSE_OPT_NOARG } 153 153 #define OPT_CALLBACK_DEFAULT(s, l, v, a, h, f, d) \ 154 - { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f), .defval = (intptr_t)d, .flags = PARSE_OPT_LASTARG_DEFAULT } 154 + { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f), .defval = (intptr_t)d, .flags = PARSE_OPT_LASTARG_DEFAULT } 155 155 #define OPT_CALLBACK_DEFAULT_NOOPT(s, l, v, a, h, f, d) \ 156 156 { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l),\ 157 - .value = (v), (a), .help = (h), .callback = (f), .defval = (intptr_t)d,\ 157 + .value = (v), .arg = (a), .help = (h), .callback = (f), .defval = (intptr_t)d,\ 158 158 .flags = PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NOARG} 159 159 #define OPT_CALLBACK_OPTARG(s, l, v, d, a, h, f) \ 160 160 { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), \ 161 - .value = (v), (a), .help = (h), .callback = (f), \ 161 + .value = (v), .argh = (a), .help = (h), .callback = (f), \ 162 162 .flags = PARSE_OPT_OPTARG, .data = (d) } 163 163 164 164 /* parse_options() will filter out the processed options and leave the