Add missing sentinel 'char *' casts in concat/reconcat calls
authorPedro Alves <palves@redhat.com>
Thu, 21 Apr 2016 10:34:18 +0000 (11:34 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 21 Apr 2016 10:34:18 +0000 (11:34 +0100)
The wildebeest-debian-wheezy-i686 buildslave's build is broken due to:

 ../../binutils-gdb/gdb/python/python.c: In function void _initialize_python():
 ../../binutils-gdb/gdb/python/python.c:1709:36: error: missing sentinel in function call [-Werror=format]

Reproduced on Fedora 23 by sticking a few:

 #undef NULL
 #define 0

in build/gdb/build-gnulib/{stddef|signal|stdio}.h.  Hopefully this
caught all instances.

gdb/ChangeLog:
2016-04-21  Pedro Alves  <palves@redhat.com>

* dwarf2read.c (try_open_dwop_file, open_dwo_file)
(file_file_name, file_full_name): Add char * cast to sentinel in
concat/reconcat calls.
* event-top.c (top_level_prompt): Likewise.
* guile/guile.c (initialize_scheme_side): Likewise.
* linux-tdep.c (linux_fill_prpsinfo): Likewise.
* macrotab.c (macro_source_fullname): Likewise.
* main.c (get_init_files, captured_main): Likewise.
* psymtab.c (psymtab_to_fullname): Likewise.
* python/python.c (_initialize_python)
(gdbpy_finish_initialization): Likewise.
* source.c (symtab_to_fullname): Likewise.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/event-top.c
gdb/guile/guile.c
gdb/linux-tdep.c
gdb/macrotab.c
gdb/main.c
gdb/psymtab.c
gdb/python/python.c
gdb/source.c

index 30a306c63638746fd1603a1797bb5dfa5168bdb4..f16912c80c590ae8b891d0acccf7ddf36a89ace6 100644 (file)
@@ -1,3 +1,18 @@
+2016-04-21  Pedro Alves  <palves@redhat.com>
+
+       * dwarf2read.c (try_open_dwop_file, open_dwo_file)
+       (file_file_name, file_full_name): Add char * cast to sentinel in
+       concat/reconcat calls.
+       * event-top.c (top_level_prompt): Likewise.
+       * guile/guile.c (initialize_scheme_side): Likewise.
+       * linux-tdep.c (linux_fill_prpsinfo): Likewise.
+       * macrotab.c (macro_source_fullname): Likewise.
+       * main.c (get_init_files, captured_main): Likewise.
+       * psymtab.c (psymtab_to_fullname): Likewise.
+       * python/python.c (_initialize_python)
+       (gdbpy_finish_initialization): Likewise.
+       * source.c (symtab_to_fullname): Likewise.
+
 2016-04-20  Pedro Alves  <palves@redhat.com>
 
        * build-with-cxx.m4 (GDB_AC_BUILD_WITH_CXX): Default to yes.
index dcd49e35ecaa69b2e2d74d9eacc6e44cee68a7d6..7bbf0804aa3876f2e97848fd94da9323d9d1cdf8 100644 (file)
@@ -10482,7 +10482,7 @@ try_open_dwop_file (const char *file_name, int is_dwp, int search_cwd)
     {
       if (*debug_file_directory != '\0')
        search_path = concat (".", dirname_separator_string,
-                             debug_file_directory, NULL);
+                             debug_file_directory, (char *) NULL);
       else
        search_path = xstrdup (".");
     }
@@ -10538,7 +10538,8 @@ open_dwo_file (const char *file_name, const char *comp_dir)
 
   if (comp_dir != NULL)
     {
-      char *path_to_try = concat (comp_dir, SLASH_STRING, file_name, NULL);
+      char *path_to_try = concat (comp_dir, SLASH_STRING,
+                                 file_name, (char *) NULL);
 
       /* NOTE: If comp_dir is a relative path, this will also try the
         search path, which seems useful.  */
@@ -20871,7 +20872,7 @@ file_file_name (int file, struct line_header *lh)
          || lh->include_dirs == NULL)
         return xstrdup (fe->name);
       return concat (lh->include_dirs[fe->dir_index - 1], SLASH_STRING,
-                    fe->name, NULL);
+                    fe->name, (char *) NULL);
     }
   else
     {
@@ -20906,7 +20907,8 @@ file_full_name (int file, struct line_header *lh, const char *comp_dir)
 
       if (IS_ABSOLUTE_PATH (relative) || comp_dir == NULL)
        return relative;
-      return reconcat (relative, comp_dir, SLASH_STRING, relative, NULL);
+      return reconcat (relative, comp_dir, SLASH_STRING,
+                      relative, (char *) NULL);
     }
   else
     return file_file_name (file, lh);
index fc1a6c607531b705c9750893937496e2b8f2d88f..ee8684bbbebb784c37ad7333b50a2e801084cf83 100644 (file)
@@ -364,7 +364,7 @@ top_level_prompt (void)
         beginning.  */
       const char suffix[] = "\n\032\032prompt\n";
 
-      return concat (prefix, prompt, suffix, NULL);
+      return concat (prefix, prompt, suffix, (char *) NULL);
     }
 
   return xstrdup (prompt);
index f9481c94aec0c869b65f3db6cde484629c923179..b010e59b3453ce166768afaf44fc26316ba22f21 100644 (file)
@@ -628,9 +628,9 @@ initialize_scheme_side (void)
   char *boot_scm_path;
   char *msg;
 
-  guile_datadir = concat (gdb_datadir, SLASH_STRING, "guile", NULL);
+  guile_datadir = concat (gdb_datadir, SLASH_STRING, "guile", (char *) NULL);
   boot_scm_path = concat (guile_datadir, SLASH_STRING, "gdb",
-                         SLASH_STRING, boot_scm_filename, NULL);
+                         SLASH_STRING, boot_scm_filename, (char *) NULL);
 
   scm_c_catch (SCM_BOOL_T, boot_guile_support, boot_scm_path,
               handle_boot_error, boot_scm_path, NULL, NULL);
index f197aa76fabfc0484c7da2183e7b5fca6360b28c..620181c5f2a0c847a17635ca81eee6fc2815dc02 100644 (file)
@@ -1789,7 +1789,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
 
   psargs = xstrdup (fname);
   if (infargs != NULL)
-    psargs = reconcat (psargs, psargs, " ", infargs, NULL);
+    psargs = reconcat (psargs, psargs, " ", infargs, (char *) NULL);
 
   make_cleanup (xfree, psargs);
 
index 2caf777797736ce8d90647ec153892b300b25c01..706079ecc05b59c5ed29e126a1552dc34441d3cf 100644 (file)
@@ -1102,5 +1102,5 @@ macro_source_fullname (struct macro_source_file *file)
   if (comp_dir == NULL || IS_ABSOLUTE_PATH (file->filename))
     return xstrdup (file->filename);
 
-  return concat (comp_dir, SLASH_STRING, file->filename, NULL);
+  return concat (comp_dir, SLASH_STRING, file->filename, (char *) NULL);
 }
index 2ce17136df92c9069cdc656046808993b423f642..c6c702ce8f57168c6325e0662ebbc52169cc628d 100644 (file)
@@ -232,7 +232,7 @@ get_init_files (const char **system_gdbinit,
              for (p = tmp_sys_gdbinit; IS_DIR_SEPARATOR (*p); ++p)
                continue;
              relocated_sysgdbinit = concat (gdb_datadir, SLASH_STRING, p,
-                                            NULL);
+                                            (char *) NULL);
              xfree (tmp_sys_gdbinit);
            }
          else
@@ -560,7 +560,7 @@ captured_main (void *data)
 #ifdef WITH_PYTHON_PATH
   {
     /* For later use in helping Python find itself.  */
-    char *tmp = concat (WITH_PYTHON_PATH, SLASH_STRING, "lib", NULL);
+    char *tmp = concat (WITH_PYTHON_PATH, SLASH_STRING, "lib", (char *) NULL);
 
     python_libdir = relocate_gdb_directory (tmp, PYTHON_PATH_RELOCATABLE);
     xfree (tmp);
index 94b5e7eaf76ca2a6f58cf993f441ebca5f564ad3..a39c6e257a2ad186f385ab5533dc90e67c6c9703 100644 (file)
@@ -1224,7 +1224,8 @@ psymtab_to_fullname (struct partial_symtab *ps)
          if (ps->dirname == NULL || IS_ABSOLUTE_PATH (ps->filename))
            fullname = xstrdup (ps->filename);
          else
-           fullname = concat (ps->dirname, SLASH_STRING, ps->filename, NULL);
+           fullname = concat (ps->dirname, SLASH_STRING,
+                              ps->filename, (char *) NULL);
 
          back_to = make_cleanup (xfree, fullname);
          ps->fullname = rewrite_source_path (fullname);
index 9c972ec918071ff7236dd2880554a2845475e7c0..b90e5e53dc2229afbefb6bcde22b2f2b2948f370 100644 (file)
@@ -1706,7 +1706,7 @@ message == an error message without a stack will be printed."),
      /foo/lib/pythonX.Y/...
      This must be done before calling Py_Initialize.  */
   progname = concat (ldirname (python_libdir), SLASH_STRING, "bin",
-                    SLASH_STRING, "python", NULL);
+                    SLASH_STRING, "python", (char *) NULL);
 #ifdef IS_PY3K
   oldloc = setlocale (LC_ALL, NULL);
   setlocale (LC_ALL, "");
@@ -1881,7 +1881,7 @@ gdbpy_finish_initialization (const struct extension_language_defn *extlang)
 
   /* Add the initial data-directory to sys.path.  */
 
-  gdb_pythondir = concat (gdb_datadir, SLASH_STRING, "python", NULL);
+  gdb_pythondir = concat (gdb_datadir, SLASH_STRING, "python", (char *) NULL);
   make_cleanup (xfree, gdb_pythondir);
 
   sys_path = PySys_GetObject ("path");
index 08cb2d3ab6c3306e769779752d318359d2d553b7..72da0e33be2dcd8ea178d15f8ca08c1777a9daf5 100644 (file)
@@ -1178,8 +1178,8 @@ symtab_to_fullname (struct symtab *s)
          if (SYMTAB_DIRNAME (s) == NULL || IS_ABSOLUTE_PATH (s->filename))
            fullname = xstrdup (s->filename);
          else
-           fullname = concat (SYMTAB_DIRNAME (s), SLASH_STRING, s->filename,
-                              NULL);
+           fullname = concat (SYMTAB_DIRNAME (s), SLASH_STRING,
+                              s->filename, (char *) NULL);
 
          back_to = make_cleanup (xfree, fullname);
          s->fullname = rewrite_source_path (fullname);