This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Add missing sentinel 'char *' casts in concat/reconcat calls


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b36cec19e826c19648964576ef2d20d63f99e888

commit b36cec19e826c19648964576ef2d20d63f99e888
Author: Pedro Alves <palves@redhat.com>
Date:   Thu Apr 21 11:34:18 2016 +0100

    Add missing sentinel 'char *' casts in concat/reconcat calls
    
    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.

Diff:
---
 gdb/ChangeLog       | 15 +++++++++++++++
 gdb/dwarf2read.c    | 10 ++++++----
 gdb/event-top.c     |  2 +-
 gdb/guile/guile.c   |  4 ++--
 gdb/linux-tdep.c    |  2 +-
 gdb/macrotab.c      |  2 +-
 gdb/main.c          |  4 ++--
 gdb/psymtab.c       |  3 ++-
 gdb/python/python.c |  4 ++--
 gdb/source.c        |  4 ++--
 10 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 30a306c..f16912c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index dcd49e3..7bbf080 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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);
diff --git a/gdb/event-top.c b/gdb/event-top.c
index fc1a6c6..ee8684b 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -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);
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index f9481c9..b010e59 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -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);
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index f197aa7..620181c 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -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);
 
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index 2caf777..706079e 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -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);
 }
diff --git a/gdb/main.c b/gdb/main.c
index 2ce1713..c6c702c 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -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);
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 94b5e7e..a39c6e2 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -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);
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 9c972ec..b90e5e5 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -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");
diff --git a/gdb/source.c b/gdb/source.c
index 08cb2d3..72da0e3 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]