[gdb] Fix -Wstrict-null-sentinel warning (--with-iconv-bin)
authorTom de Vries <tdevries@suse.de>
Wed, 12 Feb 2020 10:15:33 +0000 (11:15 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 12 Feb 2020 10:15:33 +0000 (11:15 +0100)
When using configure flag --with-iconv-bin=$(which iconv), we run into:
...
gdb/charset.c: In function 'void find_charset_names()':
gdb/charset.c:821:75: error: missing sentinel in function call [-Werror=format=]
     iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL);
                                                                           ^
cc1plus: all warnings being treated as errors
...

Fix the warning.

Build and reg-tested on x86_64-linux.

2020-02-12  Lukas Durfina  <ldurfina@tachyum.com>
    Tom de Vries  <tdevries@suse.de>

* charset.c (find_charset_names): Cast concat NULL sentinel to char *.

gdb/charset.c

index 5cfd2d803015ef6a5627c435037a9f86bdd84d6a..4e459c2b45d8a85144e9320f14c688524acc8a5b 100644 (file)
@@ -818,7 +818,8 @@ find_charset_names (void)
   {
     std::string iconv_dir = relocate_gdb_directory (ICONV_BIN,
                                                    ICONV_BIN_RELOCATABLE);
-    iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL);
+    iconv_program
+      = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", (char *) NULL);
   }
 #else
   iconv_program = xstrdup ("iconv");