From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11290 invoked by alias); 14 Aug 2013 11:38: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 11279 invoked by uid 89); 14 Aug 2013 11:38:29 -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.43) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 14 Aug 2013 11:38:28 +0000 Received: from md14.u-strasbg.fr (md14.u-strasbg.fr [130.79.200.249]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r7EBcKMB073634 ; Wed, 14 Aug 2013 13:38:21 +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 md14.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r7EBcKo2016286 ; Wed, 14 Aug 2013 13:38:20 +0200 Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (Authenticated sender: mullerp) by ms15.u-strasbg.fr (Postfix) with ESMTPSA id 549391FD88; Wed, 14 Aug 2013 13:38:18 +0200 (CEST) From: "Pierre Muller" To: "'Tom Tromey'" Cc: "'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> In-Reply-To: <874natr48x.fsf@fleche.redhat.com> Subject: [RFA-v2] Avoid invalid parameter warnings in C runtime function for mingw built GDB Date: Wed, 14 Aug 2013 11:38:00 -0000 Message-ID: <000001ce98e2$c6b1b950$54152bf0$@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/msg00376.txt.bz2 I followed Eli's advice to go with Tom's suggestion. > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Tom Tromey > Envoy=E9=A0: mardi 13 ao=FBt 2013 17:38 > =C0=A0: Pierre Muller > Cc=A0: 'Eli Zaretskii'; gdb-patches@sourceware.org > Objet=A0: Re: [RFC] Avoid invalid parameter warnings in C runtime function for > mingw builtr GDB >=20 > >>>>> "Pierre" =3D=3D Pierre Muller writes: >=20 > Pierre> Once again, my insufficient C knowledge is to blame... > Pierre> Would that be correct? >=20 > Pierre> #if O_CLOEXEC > Pierre> static int fopen_e_ever_failed =3D 0; > Pierre> #else > Pierre> static int fopen_e_ever_failed =3D 1; > Pierre> #endif >=20 > O_CLOEXEC is unconditionally defined earlier. > But you can just write: >=20 > /* If we provide a fake O_CLOEXEC, then don't ever try "e". */ > static int fopen_e_ever_failed =3D O_CLOEXEC =3D=3D 0; Is this OK to commit? Maybe some comments on the ChangeLog entry? Pierre Muller 2013-08-14 Pierre Muller Tom Tromey * 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. 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 09:44:40 -0000 @@ -311,7 +311,9 @@ FILE * gdb_fopen_cloexec (const char *filename, const char *opentype) { FILE *result =3D NULL; - static int fopen_e_ever_failed; + /* 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 if (!fopen_e_ever_failed) {