From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2439 invoked by alias); 14 Sep 2013 06:30:30 -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 2413 invoked by uid 89); 14 Sep 2013 06:30:29 -0000 Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.222.218) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 14 Sep 2013 06:30:29 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,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 6D1A6221074; Sat, 14 Sep 2013 08:30:25 +0200 (CEST) Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antivirus (Postfix) with ESMTP id 5CDD322107A; Sat, 14 Sep 2013 08:30:25 +0200 (CEST) Received: from md14.u-strasbg.fr (md14.u-strasbg.fr [130.79.200.249]) by mr8.u-strasbg.fr (Postfix) with ESMTP id DDB52221074; Sat, 14 Sep 2013 08:30:19 +0200 (CEST) Received: from ms16.u-strasbg.fr (ms16.u-strasbg.fr [130.79.204.116]) by md14.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r8E6UJb4011732 ; Sat, 14 Sep 2013 08:30:19 +0200 Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (Authenticated sender: mullerp) by ms16.u-strasbg.fr (Postfix) with ESMTPSA id 4CCF51FD8E; Sat, 14 Sep 2013 08:30:14 +0200 (CEST) From: "Pierre Muller" To: "'Doug Evans'" Cc: "'gdb-patches'" , "'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> <5233934f.8360440a.1d3e.ffffa937SMTPIN_ADDED_BROKEN@mx.google.com> In-Reply-To: Subject: RE: [RFA-v3] Avoid invalid parameter warnings in C runtime function for mingw built GDB Date: Sat, 14 Sep 2013 06:30:00 -0000 Message-ID: <002601ceb113$e0b4bfc0$a21e3f40$@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/msg00417.txt.bz2 Thank you for the approval. For the record, below is what I committed. This patch suppresses this warning: warning: Invalid parameter passed to C runtime function. that appeared for *-*-mingw* hosts when debugging gdb with itself. Pierre Muller 2013-09-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: src/gdb/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 --- src/gdb/common/filestuff.c 26 Jun 2013 08:01:55 -0000 1.7 +++ src/gdb/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; if (!fopen_e_ever_failed) { > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Doug Evans > Envoy=E9=A0: samedi 14 septembre 2013 01:08 > =C0=A0: Pierre Muller > Cc=A0: gdb-patches; Tom Tromey; Eli Zaretskii; Pedro Alves > Objet=A0: Re: [RFA-v3] Avoid invalid parameter warnings in C runtime function > for mingw built GDB >=20 > Hi. > Patch is ok with me. >=20 > On Fri, Sep 13, 2013 at 3:35 PM, Pierre Muller > wrote: > > Ping? > > > > Nobody reacted to this third version... > > > > Pierre Muller > > > > > >> -----Message d'origine----- > >> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches- > >> owner@sourceware.org] De la part de Pierre Muller > >> Envoy=E9 : mercredi 14 ao=FBt 2013 14:13 > >> =C0 : 'Pedro Alves' > >> Cc : 'Tom Tromey'; 'Eli Zaretskii'; gdb-patches@sourceware.org > >> Objet : [RFA-v3] Avoid invalid parameter warnings in C runtime function > > for > >> mingw built GDB > >> > >> > >> > >> > -----Message d'origine----- > >> > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches- > >> > owner@sourceware.org] De la part de Pedro Alves > >> > Envoy=E9 : mercredi 14 ao=FBt 2013 14:02 > >> > =C0 : Pierre Muller > >> > Cc : 'Tom Tromey'; 'Eli Zaretskii'; gdb-patches@sourceware.org > >> > Objet : 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. > >> > >> I knew that the ChangeLog entry was not what is usually expected... > >> But your version seems perfect! > >> > >> > 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... > >> > >> > -- > >> > 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; > >> > >> if (!fopen_e_ever_failed) > >> {