From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Tom Tromey'" <tromey@redhat.com>
Cc: "'Eli Zaretskii'" <eliz@gnu.org>, <gdb-patches@sourceware.org>
Subject: [RFA-v2] Avoid invalid parameter warnings in C runtime function for mingw built GDB
Date: Wed, 14 Aug 2013 11:38:00 -0000 [thread overview]
Message-ID: <000001ce98e2$c6b1b950$54152bf0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <874natr48x.fsf@fleche.redhat.com>
I followed Eli's advice to go with Tom's suggestion.
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : mardi 13 août 2013 17:38
> À : Pierre Muller
> Cc : 'Eli Zaretskii'; gdb-patches@sourceware.org
> Objet : Re: [RFC] Avoid invalid parameter warnings in C runtime function
for
> mingw builtr GDB
>
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
writes:
>
> Pierre> Once again, my insufficient C knowledge is to blame...
> Pierre> Would that be correct?
>
> Pierre> #if O_CLOEXEC
> Pierre> static int fopen_e_ever_failed = 0;
> Pierre> #else
> Pierre> static int fopen_e_ever_failed = 1;
> Pierre> #endif
>
> O_CLOEXEC is unconditionally defined earlier.
> But you can just write:
>
> /* If we provide a fake O_CLOEXEC, then don't ever try "e". */
> static int fopen_e_ever_failed = O_CLOEXEC == 0;
Is this OK to commit?
Maybe some comments on the ChangeLog entry?
Pierre Muller
2013-08-14 Pierre Muller <muller@sourceware.org>
Tom Tromey <tromey@redhat.com>
* 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
===================================================================
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 = 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 = O_CLOEXEC == 0;
if (!fopen_e_ever_failed)
{
next prev parent reply other threads:[~2013-08-14 11:38 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 ` Pierre Muller [this message]
[not found] ` <520b6c37.e9e6440a.7cfb.45fcSMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-14 12:01 ` [RFA-v2] Avoid invalid parameter warnings in C runtime function for mingw built GDB 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
[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='000001ce98e2$c6b1b950$54152bf0$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--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