Message ID | AS8P193MB1285CCA642054E2286C39AB7E4182@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 22A703858288 for <patchwork@sourceware.org>; Thu, 2 May 2024 13:21:42 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2103.outbound.protection.outlook.com [40.92.91.103]) by sourceware.org (Postfix) with ESMTPS id 1B7513858C56 for <gdb-patches@sourceware.org>; Thu, 2 May 2024 13:21:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1B7513858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1B7513858C56 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.92.91.103 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1714656080; cv=pass; b=KO51rqm0eEp5WjjtCWO8Q9N1AcXxDw8CxzubuWrWtOeOK0HWO92XhKt4WugCucamF45+rM0tv9upXRyuInZtXKh2Lj5BkwFZPSJ3y1la/vkpkxkxiZmqszl+9wA02zDInKO+towRCxra+gMmEsneZdMx6faCfphn9Uaqy89T+Aw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1714656080; c=relaxed/simple; bh=9K4M8K8cpENT8jqhkgPH+sQIk+PM4DwRANxVSbOozLw=; h=DKIM-Signature:Message-ID:Date:To:From:Subject:MIME-Version; b=oaCqPk8VJS6wsCvEFAJXgfnJUSW+SEkX+95m0rch1gd6eyPgAYZdF1IJx2zXLE+FxxTXAyyVfj+Lv/8rBtep9o7LxS7KjeChPJJM3VhmFyWLtBbQ+G3tEXenJ0UP5PQWwVqOTLW+epPXZxVGOHXid3w91BSE6WVG6sJzKzVE3us= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PUCRptes99QL3bnaarIdQDJO8XVJLAD2xo7s1pZ5xUIV1+3oUZXx8UiBWCLqvqYRRb5HAu6urpXu6xuKnSsGdjf3xWToSTEzoUze5XO4sjYiIR7tFucXVwmWSTBbvEPH2D40mr0OOyfS8V9dMOfiNrHT80s9HvB3ZYYFuOnfcAW09gTnx7emNzf6vYETX4ss4A4Wrj4VG+QptzyMuWRb5OjRuhTt2tbjJbaKZacVAqRw+1ItaoBfwmmFU+TDNPqd6JIT7Zb7eJ4dPyXidH3RSKZFLXrUJhWE5Asap0Qu/Gce5BSlj+k7sYhlKOYJanFiwKpWdcUm0NrKFxYUiafQgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=99AXI5EienTU9b11/LHEEflN6mpaNlyrQcLQVtF43/o=; b=Oydcd8cndEO02tAhzrw3aR1NUxfgoo/o1vf7U5MbF57K11pNZ6KSORG1LdLDprF94PzMLI6Wij9Ir3gUqSA06HnW9ItHAwK1BMSBHpwlS2T/8JzU/lSuZ3Eb/FwmM9aUEH/lj6TaVPbm+NRYGaDxkce6ei44cNvea7EMVFcFkuteZ7PsrI4eMJeXQJyKB6EElU7+WBeBsx2iSQCXiDNDEljq7HafBywCDPosy+r9hUVcqOxHSx02DwJAkJSBNr4oNdBPUubgafe3ifdp8kui6mgRq0DMgdt93zEwIRv4RCs/+FOubPgfM+Gd2068hCiw2n0YwA0GT7VMsMVCzuwt1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=HOTMAIL.DE; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=99AXI5EienTU9b11/LHEEflN6mpaNlyrQcLQVtF43/o=; b=EzgUub8Ty1i0qW+V9KjP4NtJnjw5B78ezViRD1PVV63QwB76c+GPAp6NdlPmSnNbiGQtQGy2/O4U44asjs9WZaTcXGREztuuKk0Gcx/PAkgUjym4w8ybY2zBKIoUT/M4Q5nPdaC4z6f+6Ho1bSrcjdDbsS3zuZ+Ndlfks90HOP2NsTzSFuZ7Y5rTVlVBZARw5rTu/ueY6rJWBP3YoSe2+OBfBLU9ZBYG+RTwhkFUyd6g1Gp+kjwae0PBvvFGaiiM0ymn3oi5M2kRaKUdlq28v+oKFoaOs7Zu9bVNQ4Ctaom8k9Vmtsh6Dunw3VEE0JRpcF+kLJ5ZYxaVx+N4HdgQAw== Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) by DU2P193MB2403.EURP193.PROD.OUTLOOK.COM (2603:10a6:10:2fc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Thu, 2 May 2024 13:21:16 +0000 Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::e65d:5dd2:5662:c61f]) by AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::e65d:5dd2:5662:c61f%3]) with mapi id 15.20.7519.035; Thu, 2 May 2024 13:21:16 +0000 Message-ID: <AS8P193MB1285CCA642054E2286C39AB7E4182@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM> Date: Thu, 2 May 2024 15:23:17 +0200 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org> From: Bernd Edlinger <bernd.edlinger@hotmail.de> Subject: [PATCH] sim: fix a warning in dv-sockser.c at connected_p() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TMN: [YDgbJ7U5MSYyIFp10/EtXcETi1ld/TwQT/Yu1+SWh/2T8bLQ32NQXomrDb2wZE7O] X-ClientProxiedBy: FR5P281CA0008.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f2::10) To AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) X-Microsoft-Original-Message-ID: <ccd2ff44-7dcf-4103-8abd-aa367ee28d09@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P193MB1285:EE_|DU2P193MB2403:EE_ X-MS-Office365-Filtering-Correlation-Id: 48be2ff8-e496-49fe-136e-08dc6aaabe9d X-Microsoft-Antispam: BCL:0;ARA:14566002|461199019|440099019|3412199016; X-Microsoft-Antispam-Message-Info: ibp67xO2AATcil+CcJodONuY5LbknIkNoIyhEdXEB+jv+yt2Su4DIlpML0lfZTUa323GeQuKMDle4lWEP+o547ZCQ51ogJXhlUmKXWCFME+CDv3uiXBL1dCHm2Vq31g+qq1ruqDbrLvsruqTxbs1x/gCD3Zj/zAnes4jau0ny9qbXrumFOKk0BYsJCfsjYXWwyC1a8JXMXTqhbc0IzZaaOWMpoEXJ8wGFNBC4eTEVZeVUWANH/eAQKeqRDwEoLOvNkjzfePDfZRd8OQ8FP08nBGNlZDSHuDHv5iWhtBBkDr+DvXgck5VZjc9phDirl2I7YoOw+RAnH6XC8GH7a2FRU9reYOQqTVulbwid0Rm2GgwNvd4I+1azK2sfxUjlc0Gfe2GGPLz+PlH7NPKdE7kb7zi03BNJlWlz0ecFR1FkrUu7Auvu2Mh/fDLrMSnnb1axRKVF+KnUvGoxBeVxb7GtpN6LQM8AyLVZB48F8iu7+5sPfylTRaA5RG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IT7fK2q7jZjf6w?= =?utf-8?q?yRMaA04UfkYjUVlm4TYXS31xmoK3ZtOtoh5TCzw//J6pYH93btcqOw+JU1+pmPVBG?= =?utf-8?q?K9J5rrzHWY/cu0uXuZYYhgeMqAgYw5x/QSmQZiQrSo/0lruLsm7qpMDBGdh6MfCwO?= =?utf-8?q?UrJrDXz2us+g8uE2zTEQkUzs3BnU7lxIH99SMMi+shrCQ7ruDP5Te77RyZt6TT7mA?= =?utf-8?q?z7BQU4KrXXznki0JqOblFmIwRvwWgoGXvmMZgYlJGC1GZWiU0mpyp4QO4kr/bSvEm?= =?utf-8?q?cfnUN41Zhn+n1k+Z1ifPdV4mOA3GtT19bo3IGb9irUvxcp6AZJ7qEsrbW8FRRnoaQ?= =?utf-8?q?pRfga50sHCTe1DXEfeTt6k6xSQxl2Nj0bPvs6ByhcBgMnRurhs1kGFY6P2RSZVM99?= =?utf-8?q?K/Zr0ygfX6RfXPi8BhdjM9rAyNPLseaE/zFMwFv+na93C8VMK0ZGj1/Pvm3hQ6W5J?= =?utf-8?q?QYEzSdThpCus9uY2cC+gJyC1myon2xdvTtoJheLFXcy92vq3wR9OrPL+5//qIFT2Y?= =?utf-8?q?R9WCe5x9YXfWgF2T?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-80ceb.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 48be2ff8-e496-49fe-136e-08dc6aaabe9d X-MS-Exchange-CrossTenant-AuthSource: AS8P193MB1285.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2024 13:21:15.9420 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P193MB2403 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
sim: fix a warning in dv-sockser.c at connected_p()
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_check--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Testing passed |
Commit Message
Bernd Edlinger
May 2, 2024, 1:23 p.m. UTC
In some O/S e.g. windows there is a warning here about the unused variable flags which triggers a -Werror build failure. Fix that by making the variable declaration optional. --- sim/common/dv-sockser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Comments
>>>>> "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?
Tom
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
Bernd> This would not be compliant to C99, and it would be the first use of this Bernd> C11 feature in this file. Therefore I did not want to go that way. Bernd> I did also consider adding braces { } around this whole block, but Bernd> actually I do think that guarding the declaration with one #if is also Bernd> acceptable and is looking not too ugly, since the function is not too complex. According to sim/README-HACKING, the sim requires C11 now. Tom
On 2024-05-03 16:35, Tom Tromey wrote: > Bernd> This would not be compliant to C99, and it would be the first use of this > Bernd> C11 feature in this file. Therefore I did not want to go that way. > Bernd> I did also consider adding braces { } around this whole block, but > Bernd> actually I do think that guarding the declaration with one #if is also > Bernd> acceptable and is looking not too ugly, since the function is not too complex. > > According to sim/README-HACKING, the sim requires C11 now. > And declaring a variable in the middle of the block is a C99 feature, not C11, regardless.
diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c index db81233e25b..0cb46947885 100644 --- a/sim/common/dv-sockser.c +++ b/sim/common/dv-sockser.c @@ -218,11 +218,14 @@ sim_install_dv_sockser (SIM_DESC sd) static int connected_p (SIM_DESC sd) { - int numfds,flags; + int numfds; struct timeval tv; fd_set readfds; struct sockaddr sockaddr; socklen_t addrlen; +#if defined(F_GETFL) && defined(O_NONBLOCK) + int flags; +#endif if (sockser_listen_fd == -1) return 0;