util/cbfstool: Fix building with clang & -Wshadow
Clang -Wshadow is more rigorous than GCC and picks a shadowing of the optarg global variable in /usr/include/bits/getopt_core.h . TESTED: builds with both gcc and clang. Change-Id: Ifc362c84511abb6a000671f03498e841d7747074 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70508 Reviewed-by: Kapil Porwal <kapilporwal@google.com> Reviewed-by: Tarun Tuli <taruntuli@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
parent
c4f5241e66
commit
8f95f74eb2
|
@ -340,9 +340,9 @@ static void add_mmap_window(size_t flash_offset, size_t host_offset,
|
|||
}
|
||||
|
||||
|
||||
static int decode_mmap_arg(char *optarg)
|
||||
static int decode_mmap_arg(char *arg)
|
||||
{
|
||||
if (optarg == NULL)
|
||||
if (arg == NULL)
|
||||
return 1;
|
||||
|
||||
union {
|
||||
|
@ -354,17 +354,17 @@ static int decode_mmap_arg(char *optarg)
|
|||
};
|
||||
} mmap_args;
|
||||
char *suffix = NULL;
|
||||
char *substring = strtok(optarg, ":");
|
||||
char *substring = strtok(arg, ":");
|
||||
for (size_t i = 0; i < ARRAY_SIZE(mmap_args.array); i++) {
|
||||
if (!substring) {
|
||||
ERROR("Invalid mmap arguments '%s'.\n",
|
||||
optarg);
|
||||
arg);
|
||||
return 1;
|
||||
}
|
||||
mmap_args.array[i] = strtol(substring, &suffix, 0);
|
||||
if (suffix && *suffix) {
|
||||
ERROR("Invalid mmap arguments '%s'.\n",
|
||||
optarg);
|
||||
arg);
|
||||
return 1;
|
||||
}
|
||||
substring = strtok(NULL, ":");
|
||||
|
@ -372,7 +372,7 @@ static int decode_mmap_arg(char *optarg)
|
|||
|
||||
if (substring != NULL) {
|
||||
ERROR("Invalid argument, too many substrings '%s'.\n",
|
||||
optarg);
|
||||
arg);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue