From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22772 invoked by alias); 3 May 2010 20:19:30 -0000 Received: (qmail 22573 invoked by uid 22791); 3 May 2010 20:19:29 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 03 May 2010 20:19:25 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id o43KJ6rj029808; Mon, 3 May 2010 22:19:06 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id o43KJ55C028671; Mon, 3 May 2010 22:19:05 +0200 (CEST) Date: Mon, 03 May 2010 20:19:00 -0000 Message-Id: <201005032019.o43KJ55C028671@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: jan.kratochvil@redhat.com CC: gdb-patches@sourceware.org In-reply-to: <20100502075217.GA29039@host0.dyn.jankratochvil.net> (message from Jan Kratochvil on Sun, 2 May 2010 09:52:17 +0200) Subject: Re: [patch 1/3] Make obconcat use stdarg References: <20100430181605.GA19190@host0.dyn.jankratochvil.net> <201004301908.o3UJ8mGf006742@glazunov.sibelius.xs4all.nl> <20100502075217.GA29039@host0.dyn.jankratochvil.net> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-05/txt/msg00052.txt.bz2 > Date: Sun, 2 May 2010 09:52:17 +0200 > From: Jan Kratochvil > > On Fri, 30 Apr 2010 21:08:48 +0200, Mark Kettenis wrote: > > I'm afraid you'll need an explicit cast for the NULLs used as the > > sentinel value > > There is also needed a fix for cases already protected by ATTRIBUTE_SENTINEL > and already using just the bare "NULL" sentinel: > > concat reconcat concat_length concat_copy concat_copy2 > > fbsd-nat.c by Mark Kettenis 50e330a0 2004-09-19 > (reconcat has ATTRIBUTE_SENTINEL since bf7628f0 2004-09-05) > psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL); > remote.c [HAVE_LIBEXPAT] > remote_support_xml = concat ("xmlRegisters=", xml, NULL); > p = concat (remote_support_xml, ",", xml, NULL); > remote.c d5ea7042 2010-03-30 > char *p = concat (msg, ";", append, NULL); > char *p = concat ("qSupported:", q, NULL); > name = concat ("$", tsv->name, NULL); > utils.c 8b58bcf2 2009-01-26 > concat ("maintenance set ", problem->name, " ", NULL), > concat ("maintenance show ", problem->name, " ", NULL), > > Nobody has noticed this problem since 2004. Obviously the number of platforms that have: 1. Define NULL as an integer 0. 2. Use a compiler for which we turn on the sentinel warning. is vanishingly small. Incidentally I'm working on switching the OpenBSD system compiler from GCC 3.x to GCC 4.x. And warnings about the cases you mention above do show up. Here's a diff to address them. ok? 2010-05-03 Mark Kettenis * remote.c (register_remote_support_xml) (remote_query_supported_append, remote_query_supported): Add cast to NULL used as sentinel. * tracepoint.c (tvariables_info_1): Likewise. * utils.c (add_internal_problem_command): Likewise. Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.402 diff -u -p -r1.402 remote.c --- remote.c 16 Apr 2010 07:49:35 -0000 1.402 +++ remote.c 3 May 2010 20:08:09 -0000 @@ -3473,7 +3473,7 @@ register_remote_support_xml (const char { #if defined(HAVE_LIBEXPAT) if (remote_support_xml == NULL) - remote_support_xml = concat ("xmlRegisters=", xml, NULL); + remote_support_xml = concat ("xmlRegisters=", xml, (char *)NULL); else { char *copy = xstrdup (remote_support_xml + 13); @@ -3491,7 +3491,7 @@ register_remote_support_xml (const char while ((p = strtok (NULL, ",")) != NULL); xfree (copy); - p = concat (remote_support_xml, ",", xml, NULL); + p = concat (remote_support_xml, ",", xml, (char *)NULL); xfree (remote_support_xml); remote_support_xml = p; } @@ -3503,7 +3503,7 @@ remote_query_supported_append (char *msg { if (msg) { - char *p = concat (msg, ";", append, NULL); + char *p = concat (msg, ";", append, (char *)NULL); xfree (msg); return p; } @@ -3543,7 +3543,7 @@ remote_query_supported (void) if (q) { - char *p = concat ("qSupported:", q, NULL); + char *p = concat ("qSupported:", q, (char *)NULL); xfree (q); putpkt (p); xfree (p); Index: tracepoint.c =================================================================== RCS file: /cvs/src/src/gdb/tracepoint.c,v retrieving revision 1.184 diff -u -p -r1.184 tracepoint.c --- tracepoint.c 23 Apr 2010 23:51:05 -0000 1.184 +++ tracepoint.c 3 May 2010 20:08:10 -0000 @@ -446,7 +446,7 @@ tvariables_info_1 (void) back_to2 = make_cleanup_ui_out_tuple_begin_end (uiout, "variable"); - name = concat ("$", tsv->name, NULL); + name = concat ("$", tsv->name, (char *)NULL); make_cleanup (xfree, name); ui_out_field_string (uiout, "name", name); ui_out_field_string (uiout, "initial", plongest (tsv->initial_value)); Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.228 diff -u -p -r1.228 utils.c --- utils.c 8 Mar 2010 19:20:38 -0000 1.228 +++ utils.c 3 May 2010 20:08:11 -0000 @@ -1120,13 +1120,15 @@ add_internal_problem_command (struct int add_prefix_cmd ((char*) problem->name, class_maintenance, set_internal_problem_cmd, set_doc, set_cmd_list, - concat ("maintenance set ", problem->name, " ", NULL), + concat ("maintenance set ", problem->name, " ", + (char *)NULL), 0/*allow-unknown*/, &maintenance_set_cmdlist); add_prefix_cmd ((char*) problem->name, class_maintenance, show_internal_problem_cmd, show_doc, show_cmd_list, - concat ("maintenance show ", problem->name, " ", NULL), + concat ("maintenance show ", problem->name, " ", + (char *)NULL), 0/*allow-unknown*/, &maintenance_show_cmdlist); set_doc = xstrprintf (_("\