From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6966 invoked by alias); 1 Oct 2009 21:22:29 -0000 Received: (qmail 6950 invoked by uid 22791); 1 Oct 2009 21:22:28 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Oct 2009 21:22:22 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id n91LLwEI081685 ; Thu, 1 Oct 2009 23:21:58 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n91LLv8X017031 ; Thu, 1 Oct 2009 23:21:57 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n91LLuO3061326 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Thu, 1 Oct 2009 23:21:56 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: "'Joel Brobecker'" Cc: , References: <20090930204828.GB31446@adacore.com> <004701ca428e$fa377c50$eea674f0$@u-strasbg.fr> <20091001172928.GE6532@adacore.com> In-Reply-To: <20091001172928.GE6532@adacore.com> Subject: [RFA] more fixes to testsuite (was RE: GDB 6.8.92 available for testing) Date: Thu, 01 Oct 2009 21:22:00 -0000 Message-ID: <000c01ca42dd$3f8c37c0$bea4a740$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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: 2009-10/txt/msg00030.txt.bz2 I here request approval=20 for changes to the testsuite related to=20 problems on a configuration where gcc emits format warnings by default. > -----Message d'origine----- > De : gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] De la > part de Joel Brobecker > Envoy=E9 : Thursday, October 01, 2009 7:29 PM > =C0 : Pierre Muller > Cc : gdb@sourceware.org > Objet : Re: GDB 6.8.92 available for testing >=20 > > 3) gdb.base/shr1.c (wrong format arg type) > > 3) is about an address, but "%p" does not seem to be supported by all > > C lib format implementation, so I don't know if this can be fixed > correctly. >=20 > We already use %p in a couple of testcase, so let's use it again here. > Best to avoid printing stuff on stdout/stderr when writing a testcase, > as we don't always have access to the inferior output (for instance, > when doing remote debugging), so matching the inferior output in the > testcase won't work in those case. But we'd have to dig deeper in > the history of this testcase to determine whether removing the printf > would not impact the effectiveness of the testcase. I used "%p" as suggested. =20=20 > For now, I vote for a group hug and the use of %p. >=20 > > 4) gdb.base/unload.c (format arg not literal) > > 5) gdb.base/watchpoint-solib.c (format arg not literal) > > 4) and 5) seem more difficult ... >=20 > Is that the source of the problem? >=20 > fprintf (stderr, dlerror ()); >=20 > The following should take care of it: >=20 > fprintf (stderr, "%s", dlerror ()) >=20 > -- > Joel This was a bit more tricky, because dlerror is a macro if __WIN32__ is defined,=20 I removed the macro and separated the fprintf. Is this OK? =20 Tested on gcc16, no changes in the results of these tests. PS: the #ifdef __WIN32__ should probably be replaced by=20 something that is also defined for 64-bit windows, no? 2009-10-01 Pierre Muller * src/gdb/testsuite/gdb.base/shr1.c: Use %p in format string. * src/gdb/testsuite/gdb.base/unload.c: Avoid warning in fprintf. * src/gdb/testsuite/gdb.base/watchpoint-solib.c: Idem. Index: src/gdb/testsuite/gdb.base/shr1.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shr1.c,v retrieving revision 1.1.1.2 diff -u -p -r1.1.1.2 shr1.c --- src/gdb/testsuite/gdb.base/shr1.c 28 Jun 1999 16:04:00 -0000 1.1.1.2 +++ src/gdb/testsuite/gdb.base/shr1.c 1 Oct 2009 20:58:06 -0000 @@ -25,7 +25,7 @@ int x; sg =3D 6.6; sgi++; sgs =3D 8; - printf("address of sgs is 0x%x\n", &sgs); + printf("address of sgs is %p\n", &sgs); return 2*x; } =20 Index: src/gdb/testsuite/gdb.base/unload.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.base/unload.c,v retrieving revision 1.9 diff -u -p -r1.9 unload.c --- src/gdb/testsuite/gdb.base/unload.c 3 Jan 2009 05:58:03 -0000 1.9 +++ src/gdb/testsuite/gdb.base/unload.c 1 Oct 2009 20:58:06 -0000 @@ -27,7 +27,6 @@ # define dlsym(handle, func) GetProcAddress (handle, func) #endif #define dlclose(handle) FreeLibrary (handle) -#define dlerror() "error %d occurred", GetLastError () #else #include #endif @@ -53,7 +52,11 @@ int main() =20 if (!unloadshr) { - fprintf (stderr, dlerror ()); +#ifdef __WIN32__ + fprintf (stderr, "error %d occurred", GetLastError ()); +#else + fprintf (stderr, "%s", dlerror ()); +#endif exit (1); } =20 Index: src/gdb/testsuite/gdb.base/watchpoint-solib.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint-solib.c,v retrieving revision 1.2 diff -u -p -r1.2 watchpoint-solib.c --- src/gdb/testsuite/gdb.base/watchpoint-solib.c 3 Jan 2009 05:58:03 -0000 1.2 +++ src/gdb/testsuite/gdb.base/watchpoint-solib.c 1 Oct 2009 20:58:06 -0000 @@ -27,7 +27,6 @@ # define dlsym(handle, func) GetProcAddress (handle, func) #endif #define dlclose(handle) FreeLibrary (handle) -#define dlerror() "error %d occurred", GetLastError () #else #include #endif @@ -42,7 +41,11 @@ void open_shlib () =20=20=20 if (!handle) { - fprintf (stderr, dlerror ()); +#ifdef __WIN32__ + fprintf (stderr, "error %d occurred", GetLastError ()); +#else + fprintf (stderr, "%s", dlerror ()); +#endif exit (1); } =20