From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: Tom Tromey <tom@tromey.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] sim: fix a warning in dv-sockser.c at connected_p()
Date: Fri, 3 May 2024 11:00:29 +0200 [thread overview]
Message-ID: <AS8P193MB12856EB4F23EFB9C7FD40B03E41F2@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <87o79odwc0.fsf@tromey.com>
On 5/2/24 18:15, Tom Tromey wrote:
>>>>>> "Bernd" == Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
>
> Bernd> In some O/S e.g. windows there is a warning here about the
> Bernd> unused variable flags which triggers a -Werror build failure.
>
> Bernd> Fix that by making the variable declaration optional.
>
> I think this would be better if this declaration were just removed and
> then stuck into the condition, like:
>
> /* Set non-blocking i/o. */
> #if defined(F_GETFL) && defined(O_NONBLOCK)
> int flags = fcntl (sockser_fd, F_GETFL);
> ^^^ add this here
>
> What do you think?
>
This would not be compliant to C99, and it would be the first use of this
C11 feature in this file. Therefore I did not want to go that way.
I did also consider adding braces { } around this whole block, but
actually I do think that guarding the declaration with one #if is also
acceptable and is looking not too ugly, since the function is not too complex.
Thanks
Bernd.
> Tom
next prev parent reply other threads:[~2024-05-03 8:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 13:23 Bernd Edlinger
2024-05-02 16:15 ` Tom Tromey
2024-05-03 9:00 ` Bernd Edlinger [this message]
2024-05-03 15:35 ` Tom Tromey
2024-05-03 16:07 ` Pedro Alves
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=AS8P193MB12856EB4F23EFB9C7FD40B03E41F2@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM \
--to=bernd.edlinger@hotmail.de \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).