From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5DBF14570F; Thu, 1 Aug 2024 11:27:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FA7F42EB4; Thu, 1 Aug 2024 11:27:49 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2051.outbound.protection.outlook.com [40.107.236.51]) by mails.dpdk.org (Postfix) with ESMTP id BE8CB402C8 for ; Thu, 1 Aug 2024 11:27:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rh5yZ6mXH+9obADI6s/wQcHDUC0O51d7BYfH0q+BtEAevkHDIFZCVSdhQGJUwI/6cIn6orRZmQJfNeN/+haBDGKbu4QOmsH3NDtEeCpXXgUWY9T93mPk0klYjc4Sj2qWxlseqm12sI096qTkMotTxot6mpKcpcp/7C0HFEF6VcP1Ize95Oy+PHlbY2qNuIlAb17EodavwsG8tVbFigfv0lMtdS+LefMHRaTVU04vgAsLzX3ZLLX1L92Ra00vyu201fViZu+qH8e+aja6jzQM1VQMBQ9Y7HEB+K6O8hegavzEUdXtFViOuLy6JCM8Vl2RbaB7jiDcd3tzAq471l8YXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uGZOikY4gDbkGiHGNTyQzyPwpfzV7kHndC1HIfSve40=; b=awsYOhVIAtkwtbqVYpHX2FvFWPgkanjAiYtrmgBZ6Rzl1tWlnyEKrqZj53Q64EcM9aJ1hvhLhMksn2rtjTZluTO4qoBPrUuUBuRWXjAoj9Uuh8uKacKlFqnhwBgOB8GJmk+uuSVu/paqnOW9L7FrlFQMf4yysoLv//1SDb3KL+PIjkHtKoCNeP3K2c2yDJ4sNXF4HUn5zax//Klj/II49ehnaQxcWd08UyEsY89tdOfvLns05jld+GZo/TQtdNGpX4OiZRyXEMsmPSy8lSp+2brlcbqVYuR9NP60xLJ84TU5ImSCsi1f9cz0pkpnYrLgAG74x18I+JL8B2sHiX917g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=monjalon.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uGZOikY4gDbkGiHGNTyQzyPwpfzV7kHndC1HIfSve40=; b=Wwyej2V3FTFpKXrsJ3J6kEC11Tz4ZPbEtStgW4pU1iUCAL1t7ktqAINnSfE0vyhVIJFAiXYYAJAgThMnSEpBg7FnpeTjtHBlLTptB/C1ZC2FDexTDeze321KhYSABRE7z4L6S/DejveIwNcWRYmS8eCPfEQoEHrYgioHPnAsSsY= Received: from MW4PR04CA0084.namprd04.prod.outlook.com (2603:10b6:303:6b::29) by SJ0PR12MB7475.namprd12.prod.outlook.com (2603:10b6:a03:48d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.21; Thu, 1 Aug 2024 09:27:44 +0000 Received: from SJ1PEPF00001CE8.namprd03.prod.outlook.com (2603:10b6:303:6b:cafe::5e) by MW4PR04CA0084.outlook.office365.com (2603:10b6:303:6b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.35 via Frontend Transport; Thu, 1 Aug 2024 09:27:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE8.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7828.19 via Frontend Transport; Thu, 1 Aug 2024 09:27:43 +0000 Received: from dpdk-rc.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 1 Aug 2024 04:27:41 -0500 From: Ferruh Yigit To: Thomas Monjalon , Ori Kam , Andrew Rybchenko CC: Subject: [RFC] ethdev: convert string initialization Date: Thu, 1 Aug 2024 02:27:22 -0700 Message-ID: <20240801092722.3732917-1-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE8:EE_|SJ0PR12MB7475:EE_ X-MS-Office365-Filtering-Correlation-Id: cf2a254a-e14d-45cb-07aa-08dcb20c325e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?ZUNaaXlEc3JHQjc3W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nZWlzQW1mWmZVWmZx?= =?utf-8?B?OXRZKzNFWGdtb1V6dUNHZDU5YU82a3hQTUhCWW1LNzZJeWp5YWZHRkRvOHYy?= =?utf-8?B?d0E4dUdPZEZMUEZBTVY5MC93VjFadlEyOHptMUhzZjVNVUFoOEVLRzVXSWZx?= =?utf-8?Q?LXkQjrOLg69bDIAgDN0YzgYXci2zwrJQ?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 09:27:43.2736 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf2a254a-e14d-45cb-07aa-08dcb20c325e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7475 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org gcc 15 experimental [1], with -Wextra flag, gives warning in variable initialization as string [2]. The warning has a point when initialized variable is intended to use as string, since assignment is missing the required null terminator for this case. But warning is useless for our usecase. I don't know if this behaviour will change in gcc15, as it is still under development. But if not we may need to update our initialization. In this patch only updated a few instance to show the issue, there are many instances to fix, if we prefer to go this way. Other option is to disable warning but it can be useful for actual string usecases, so I prefer to keep it. [1] gcc (GCC) 15.0.0 20240801 (experimental) [2] ../lib/ethdev/rte_flow.h:906:36: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 906 | .hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/ethdev/rte_flow.h:907:36: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 907 | .hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/ethdev/rte_flow.h:1009:25: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 1009 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/ethdev/rte_flow.h:1012:25: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 1012 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/ethdev/rte_flow.h:1135:20: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 1135 | .hdr.vni = "\xff\xff\xff", | ^~~~~~~~~~~~~~ Signed-off-by: Ferruh Yigit --- lib/ethdev/rte_flow.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index f864578f806b..8b623974cd44 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -903,8 +903,8 @@ struct rte_flow_item_eth { /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */ #ifndef __cplusplus static const struct rte_flow_item_eth rte_flow_item_eth_mask = { - .hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", - .hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", + .hdr.dst_addr.addr_bytes = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + .hdr.src_addr.addr_bytes = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, .hdr.ether_type = RTE_BE16(0x0000), }; #endif @@ -1005,12 +1005,10 @@ struct rte_flow_item_ipv6 { #ifndef __cplusplus static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { .hdr = { - .src_addr = - "\xff\xff\xff\xff\xff\xff\xff\xff" - "\xff\xff\xff\xff\xff\xff\xff\xff", - .dst_addr = - "\xff\xff\xff\xff\xff\xff\xff\xff" - "\xff\xff\xff\xff\xff\xff\xff\xff", + .src_addr = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + .dst_addr = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, }, }; #endif @@ -1132,7 +1130,7 @@ struct rte_flow_item_vxlan { /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */ #ifndef __cplusplus static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { - .hdr.vni = "\xff\xff\xff", + .hdr.vni = { 0xff, 0xff, 0xff }, }; #endif -- 2.43.0