From 12b8a6e12b54767f67da8b6a6d4e96ebb8de97c1 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sat, 18 Mar 2017 13:38:20 -0700 Subject: [PATCH] Fix conststrings type mismatches. (closes #3926) The generation programs for conststrings.c: txt2c.c and txt2c.sh, specified the resultant types as "unsigned char[]" while main.c declared them as "const char[]". txt2.c generates 0xXX hex codes for each individual character, thus the "unsigned" definition. With link-time optimization, some versions of gcc notice the mismatch and emit a warning. Change the declarations to match the definitions and cast to char[] when they are used. --- main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index cafb830d..0244b2d0 100644 --- a/main.c +++ b/main.c @@ -163,9 +163,9 @@ options:\n\ exit (0); } -extern const char cc_version[]; -extern const char cc_cflags[]; -extern const char configure_options[]; +extern unsigned char cc_version[]; +extern unsigned char cc_cflags[]; +extern unsigned char configure_options[]; static char * rstrip_in_place(char *s) @@ -222,13 +222,13 @@ static void show_version (void) puts ("\n\nCompiler:"); rstrip_in_place((char *)cc_version); - puts (cc_version); + puts ((char *)cc_version); rstrip_in_place((char *)configure_options); - printf ("\nConfigure options: %s\n", configure_options); + printf ("\nConfigure options: %s\n", (char *)configure_options); rstrip_in_place((char *)cc_cflags); - printf ("\nCompilation CFLAGS: %s\n", cc_cflags); + printf ("\nCompilation CFLAGS: %s\n", (char *)cc_cflags); puts (_("\nCompile options:")); -- 2.50.1