changeset: 6970:f09b8b2454c9
user:      Kevin McCarthy <ke...@8t8.us>
date:      Sat Mar 18 13:38:20 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/f09b8b2454c9

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.

diffs (33 lines):

diff -r 23c00b71f653 -r f09b8b2454c9 main.c
--- a/main.c    Mon Mar 13 18:38:23 2017 -0700
+++ b/main.c    Sat Mar 18 13:38:20 2017 -0700
@@ -163,9 +163,9 @@
   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 @@
 
   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:"));
 

Reply via email to