Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Doug Evans'" <dje@google.com>
Cc: "'gdb-patches'" <gdb-patches@sourceware.org>,
	       "'Tom Tromey'" <tromey@redhat.com>,
	"'Eli Zaretskii'" <eliz@gnu.org>,
	       "'Pedro Alves'" <palves@redhat.com>
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	[thread overview]
Message-ID: <002601ceb113$e0b4bfc0$a21e3f40$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <CADPb22QjeqiqLvHEA-ahGU=pqVeHAkW-8SmxrLiXvBOgNn4HSg@mail.gmail.com>

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  <muller@sourceware.org>
            Tom Tromey  <tromey@redhat.com>
            Pedro Alves  <palves@redhat.com>

        * 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
===================================================================
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 = 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 = O_CLOEXEC == 0;

   if (!fopen_e_ever_failed)
     {




> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Doug Evans
> Envoyé : samedi 14 septembre 2013 01:08
> À : Pierre Muller
> Cc : gdb-patches; Tom Tromey; Eli Zaretskii; Pedro Alves
> Objet : Re: [RFA-v3] Avoid invalid parameter warnings in C runtime
function
> for mingw built GDB
> 
> Hi.
> Patch is ok with me.
> 
> On Fri, Sep 13, 2013 at 3:35 PM, Pierre Muller
> <pierre.muller@ics-cnrs.unistra.fr> 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é : mercredi 14 août 2013 14:13
> >> À : '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é : mercredi 14 août 2013 14:02
> >> > À : 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 = O_CLOEXEC == 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 = O_CLOEXEC == 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  <muller@sourceware.org>
> >>           Tom Tromey  <tromey@redhat.com>
> >>           Pedro Alves  <palves@redhat.com>
> >>
> >>       * 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
> >> ===================================================================
> >> 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 = 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 = O_CLOEXEC == 0;
> >>
> >>    if (!fopen_e_ever_failed)
> >>      {


  reply	other threads:[~2013-09-14  6:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <"002201ce9414$7e0d7130$7a285390$@muller"@ics-cnrs.unistra.fr>
2013-08-09 14:09 ` [RFC] Avoid invalid parameter warnings in C runtime function for mingw builtr GDB Eli Zaretskii
2013-08-13  9:13   ` Pierre Muller
     [not found]   ` <41630.7793967009$1376385245@news.gmane.org>
2013-08-13 15:37     ` Tom Tromey
2013-08-14 11:38       ` [RFA-v2] Avoid invalid parameter warnings in C runtime function for mingw built GDB Pierre Muller
     [not found]       ` <520b6c37.e9e6440a.7cfb.45fcSMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-14 12:01         ` Pedro Alves
2013-08-14 12:12           ` [RFA-v3] " Pierre Muller
2013-09-13 22:35             ` Pierre Muller
     [not found]           ` <5233934f.8360440a.1d3e.ffffa937SMTPIN_ADDED_BROKEN@mx.google.com>
2013-09-13 23:08             ` Doug Evans
2013-09-14  6:30               ` Pierre Muller [this message]
     [not found]   ` <"001401ce9805$6cce7050$466b50f0$@muller"@ics-cnrs.unistra.fr>
2013-08-13 16:35     ` [RFC] Avoid invalid parameter warnings in C runtime function for mingw builtr GDB Eli Zaretskii
2013-08-08  8:51 Pierre Muller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002601ceb113$e0b4bfc0$a21e3f40$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=dje@google.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox