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.
This commit is contained in:
Pedro Alves 2016-04-21 11:34:18 +01:00
parent 96bf8cb07d
commit b36cec19e8
10 changed files with 34 additions and 16 deletions

View 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.

View 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);

View 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);

View 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);

View 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);

View 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);
}

View 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);

View 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);

View 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");

View 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);