From patchwork Thu Apr 21 10:35:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 11831 Received: (qmail 110969 invoked by alias); 21 Apr 2016 10:35:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 110956 invoked by uid 89); 21 Apr 2016 10:35:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:elf_int, sk:rewrite, Hx-languages-length:8138, 2016-04-21 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 21 Apr 2016 10:35:09 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B9367F080 for ; Thu, 21 Apr 2016 10:35:08 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3LAZ738016882 for ; Thu, 21 Apr 2016 06:35:07 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Add missing sentinel 'char *' casts in concat/reconcat calls Date: Thu, 21 Apr 2016 11:35:06 +0100 Message-Id: <1461234906-25676-1-git-send-email-palves@redhat.com> 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 * 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 | 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 + + * 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 * 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);