diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2022-12-08 20:24:44 +0100 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2022-12-14 18:31:55 +0000 |
commit | 8f95f74eb2eaa6ac39f02e6d1a43180fe92a414b (patch) | |
tree | bb4eb807ccd56612f4910d186f947fe13774f9b9 /util/cbfstool | |
parent | c4f5241e66ef245cd8061972dd83716b351fd972 (diff) |
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>
Diffstat (limited to 'util/cbfstool')
-rw-r--r-- | util/cbfstool/cbfstool.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 2dcc9d1cb6..c6e451fec2 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -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; } |