Skip to content

Commit 4a223ac

Browse files
committed
Handle -Wxyz better - don't confuse with -W on its own
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
1 parent 0b4849a commit 4a223ac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/bin/mtest

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,9 @@ Build targets: build the library by default, or files (e.g. aes.o), programs (e.
637637
parser.add_argument('-S', '--size-tfm', action="store_true", default=False, help=f"as --size, but use the TF-M config file and build with {SIZE_TFM_COMPILER} -Oz for Cortex-M33")
638638
parser.add_argument('-j', '--jobs', nargs='?', const=-1, metavar='N', action="store", type=int, help="enable parallel builds, like 'make -j'. Alternatively, set the MAKEFLAGS environment variable")
639639
parser.add_argument('rest', metavar='args', nargs='*', help=REST_HELP)
640+
640641
# handle -MBEDTLS_OPTION style args manually because they confuse argparse w.r.t. -M for --memsan
641-
raw_args = [x for x in sys.argv if not x.startswith("-MBEDTLS_")][1:]
642+
raw_args = [x for x in sys.argv if not x.startswith("-MBEDTLS_") and not (len(x) > 2 and x.startswith("-W"))][1:]
642643
args, unknown_args = parser.parse_known_intermixed_args(raw_args)
643644
args.rest += unknown_args
644645

@@ -658,6 +659,7 @@ Build targets: build the library by default, or files (e.g. aes.o), programs (e.
658659
cflags = " ".join([x[7:].strip() for x in args.rest if x.startswith("CFLAGS=")])
659660
# assume any unknown args, i.e. anything starting with a "-" is to be passed to the compiler via CFLAGS
660661
cflags += " " + " ".join([x for x in args.rest if x.startswith("-") and not x.startswith("-MBEDTLS_") and not x.startswith("-PSA_WANT_")])
662+
cflags += " ".join([x for x in sys.argv if x.startswith("-W") and len(x) > 2])
661663

662664
# extract config options
663665
args.config_options = [x for x in args.rest if x.startswith("MBEDTLS_") or x.startswith("PSA_WANT_") or x.startswith("-PSA_WANT_")]

0 commit comments

Comments
 (0)