From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3039 invoked by alias); 14 Aug 2013 12:12: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 3024 invoked by uid 89); 14 Aug 2013 12:12:57 -0000 X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,MSGID_MULTIPLE_AT autolearn=no version=3.3.2 Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.201.45) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 14 Aug 2013 12:12:56 +0000 Received: from md16.u-strasbg.fr (md16.u-strasbg.fr [130.79.200.206]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r7ECCnun015469 ; Wed, 14 Aug 2013 14:12:49 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from ms15.u-strasbg.fr (ms15.u-strasbg.fr [130.79.204.115]) by md16.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r7ECCmaR020116 ; Wed, 14 Aug 2013 14:12:48 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (Authenticated sender: mullerp) by ms15.u-strasbg.fr (Postfix) with ESMTPSA id 406391FD88; Wed, 14 Aug 2013 14:12:45 +0200 (CEST) From: "Pierre Muller" To: "'Pedro Alves'" Cc: "'Tom Tromey'" , "'Eli Zaretskii'" , 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> In-Reply-To: <520B719B.3020904@redhat.com> Subject: [RFA-v3] Avoid invalid parameter warnings in C runtime function for mingw built GDB Date: Wed, 14 Aug 2013 12:12:00 -0000 Message-ID: <000301ce98e7$9747de60$c5d79b20$@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-08/txt/msg00379.txt.bz2 > -----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 >=20 > On 08/14/2013 12:38 PM, Pierre Muller wrote: >=20 > > Is this OK to commit? > > Maybe some comments on the ChangeLog entry? >=20 > > * 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. >=20 > This comment should really be in the sources instead. That here you'd > have: >=20 > * common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e" > mode if operating system doesn't know O_CLOEXEC. 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: >=20 > > + /* 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; >=20 > I suggest: >=20 > /* 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=20 static int fopen_e_ever_failed =3D O_CLOEXEC =3D=3D 0; line, which is the only real change to the code... > -- > Pedro Alves Thanks Pedro! Is this third version OK? 2013-08-14 Pierre Muller Tom Tromey Pedro Alves * common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e" mode if operating system doesn't know O_CLOEXEC. 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) {