From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27098 invoked by alias); 13 Sep 2013 22:35:57 -0000 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 Received: (qmail 27082 invoked by uid 89); 13 Sep 2013 22:35:57 -0000 Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.222.212) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Sep 2013 22:35:57 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_40,KHOP_THREADED,MSGID_MULTIPLE_AT autolearn=no version=3.3.2 X-HELO: mailhost.u-strasbg.fr Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antispam (Postfix) with ESMTP id 7972D140DAA; Sat, 14 Sep 2013 00:35:53 +0200 (CEST) Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antivirus (Postfix) with ESMTP id 65A6B140D99; Sat, 14 Sep 2013 00:35:53 +0200 (CEST) Received: from md14.u-strasbg.fr (md14.u-strasbg.fr [130.79.200.249]) by mr2.u-strasbg.fr (Postfix) with ESMTP id D4E59140DAA; Sat, 14 Sep 2013 00:35:46 +0200 (CEST) Received: from ms12.u-strasbg.fr (ms12.u-strasbg.fr [130.79.204.112]) by md14.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r8DMZkPJ008203 ; Sat, 14 Sep 2013 00:35:46 +0200 Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (Authenticated sender: mullerp) by ms12.u-strasbg.fr (Postfix) with ESMTPSA id 456201FD92; Sat, 14 Sep 2013 00:35:40 +0200 (CEST) From: "Pierre Muller" To: Cc: "'Tom Tromey'" , "'Eli Zaretskii'" , "'Pedro Alves'" References: <"002201ce9414$7e0d7130$7a285390$@muller"@ics-cnrs.unistra.fr> <83bo57rm59.fsf@gnu.org> <41630.7793967009$1376385245@news.gmane.org> <874natr48x.fsf@fleche.redhat.com> <520b6c37.e9e6440a.7cfb.45fcSMTPIN_ADDED_BROKEN@mx.google.com> <520B719B.3020904@redhat.com> <000301ce98e7$9747de60$c5d79b20$@muller@ics-cnrs.unistra.fr> In-Reply-To: <000301ce98e7$9747de60$c5d79b20$@muller@ics-cnrs.unistra.fr> Subject: RE: [RFA-v3] Avoid invalid parameter warnings in C runtime function for mingw built GDB Date: Fri, 13 Sep 2013 22:35:00 -0000 Message-ID: <000001ceb0d1$95608ff0$c021afd0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-09/txt/msg00413.txt.bz2 Ping? Nobody reacted to this third version... Pierre Muller > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pierre Muller > Envoy=E9=A0: mercredi 14 ao=FBt 2013 14:13 > =C0=A0: 'Pedro Alves' > Cc=A0: 'Tom Tromey'; 'Eli Zaretskii'; gdb-patches@sourceware.org > Objet=A0: [RFA-v3] Avoid invalid parameter warnings in C runtime function for > mingw built GDB >=20 >=20 >=20 > > -----Message d'origine----- > > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > > owner@sourceware.org] De la part de Pedro Alves > > Envoy=E9=A0: mercredi 14 ao=FBt 2013 14:02 > > =C0=A0: Pierre Muller > > Cc=A0: 'Tom Tromey'; 'Eli Zaretskii'; gdb-patches@sourceware.org > > Objet=A0: Re: [RFA-v2] Avoid invalid parameter warnings in C runtime > function > > for mingw built GDB > > > > On 08/14/2013 12:38 PM, Pierre Muller wrote: > > > > > Is this OK to commit? > > > Maybe some comments on the ChangeLog entry? > > > > > * common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e" > > > mode if operating system doesn't know O_CLOEXEC, this allows to > > > avoid getting a output debug string warning for mingw hosted > > > GDB executables. > > > > This comment should really be in the sources instead. That here you'd > > have: > > > > * common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e" > > mode if operating system doesn't know O_CLOEXEC. >=20 > I knew that the ChangeLog entry was not what is usually expected... > But your version seems perfect! >=20 > > and in the source, where you have: > > > > > + /* If O_CLOEXEC is zero, the operating system doesn't > > > + know about close on exec mode "e", so don't even try to use it. > */ > > > + static int fopen_e_ever_failed =3D O_CLOEXEC =3D=3D 0; > > > > I suggest: > > > > /* Probe for "e" support once. But, if we can tell the operating > > system doesn't know about close on exec mode "e" without probing, > > skip it. E.g., the Windows runtime issues an "Invalid parameter > > passed to C runtime function" OutputDebugString warning for > > unknown modes. Assume that if O_CLOEXEC is zero, then "e" isn't > > supported. */ > > static int fopen_e_ever_failed; > Your comment is much better indeed, but let's still keep the > static int fopen_e_ever_failed =3D O_CLOEXEC =3D=3D 0; > line, which is the only real change to the code... >=20 > > -- > > Pedro Alves >=20 > Thanks Pedro! >=20 > Is this third version OK? >=20 >=20 > 2013-08-14 Pierre Muller > Tom Tromey > Pedro Alves >=20 > * common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e" > mode if operating system doesn't know O_CLOEXEC. >=20 >=20 > Index: common/filestuff.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/common/filestuff.c,v > retrieving revision 1.7 > diff -u -p -r1.7 filestuff.c > --- common/filestuff.c 26 Jun 2013 08:01:55 -0000 1.7 > +++ common/filestuff.c 14 Aug 2013 12:07:02 -0000 > @@ -311,7 +311,13 @@ FILE * > gdb_fopen_cloexec (const char *filename, const char *opentype) > { > FILE *result =3D NULL; > - static int fopen_e_ever_failed; > + /* Probe for "e" support once. But, if we can tell the operating > + system doesn't know about close on exec mode "e" without probing, > + skip it. E.g., the Windows runtime issues an "Invalid parameter > + passed to C runtime function" OutputDebugString warning for > + unknown modes. Assume that if O_CLOEXEC is zero, then "e" isn't > + supported. */ > + static int fopen_e_ever_failed =3D O_CLOEXEC =3D=3D 0; >=20 > if (!fopen_e_ever_failed) > {