]> git.ipfire.org Git - thirdparty/git.git/commitdiff
parse-options: cast long name for OPTION_ALIAS
authorPatrick Steinhardt <ps@pks.im>
Fri, 7 Jun 2024 06:38:54 +0000 (08:38 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Jun 2024 17:30:53 +0000 (10:30 -0700)
We assign the long name for OPTION_ALIAS options to a non-constant value
field. We know that the variable will never be written to, but this will
cause warnings once we enable `-Wwrite-strings`.

Cast away the constness to be prepared for this change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
parse-options.h

index bd62e20268d01d0e9d7afbcb300c440bb3adaa9f..ae15342390837c21503ab812648a7d8fd21432a8 100644 (file)
@@ -355,7 +355,7 @@ struct option {
        .type = OPTION_ALIAS, \
        .short_name = (s), \
        .long_name = (l), \
-       .value = (source_long_name), \
+       .value = (char *)(source_long_name), \
 }
 
 #define OPT_SUBCOMMAND_F(l, v, fn, f) { \