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 12C884601A; Wed, 8 Jan 2025 10:20:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0AA040150; Wed, 8 Jan 2025 10:20:46 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mails.dpdk.org (Postfix) with ESMTP id 7E1654014F for ; Wed, 8 Jan 2025 10:20:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736328045; x=1767864045; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=hLIREe1b/9RWEKWUGUcz1IBAB5/+z0A2aGKw1Omj/Lg=; b=JjyyGOqOc3X11Rnuf4qWRH4npyUx86IAVi6abFN641LD2APM7PTDogj8 DZqHAlXxPDhoRKWeQIpjSqmWaYE92I5V4QDpJADJ7oHN6E6IAMCAY3ThT sLYcp8YJrfGvUVs/lX4pGGHYwGSsxd5PIoToyYvUkCwm8KM2QzhBE31l5 kpj+0y4dF1NfXDmfkcqGBRdvQRbBWK+BlI5Au+QVvcaAJkrBIX8KsMItp ALVk+YPhr4c1EqqVwt4BFSSnXiVGc6ZRMaZ1YyguCiAkxDpyMFqOWUI2d UNj8t0Aw7YTAdBaTyk893ILgCaolFSFtxpiBdXGu4wL8HmGpqJ7tnOlxv A==; X-CSE-ConnectionGUID: nay8SO/4SY6KtXi3cocHhg== X-CSE-MsgGUID: J/rWnAGvRgiLNwG5v3vAfA== X-IronPort-AV: E=McAfee;i="6700,10204,11308"; a="35835633" X-IronPort-AV: E=Sophos;i="6.12,297,1728975600"; d="scan'208";a="35835633" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 01:20:43 -0800 X-CSE-ConnectionGUID: s+NsJezdQouJWrcuakWeQA== X-CSE-MsgGUID: rXifQ5fzT4O8Gr+oHy/xYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="102898489" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa010.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Jan 2025 01:20:42 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Wed, 8 Jan 2025 01:20:41 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44 via Frontend Transport; Wed, 8 Jan 2025 01:20:41 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.171) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.44; Wed, 8 Jan 2025 01:20:41 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BSFtJOkdg9/jPB/uHTWZiDJRXxg/ipFl0y4Le807yTGyuFNlX4xzcvD6Jq4b6KybXyjOaMTBvmxku3XZROaK2Wn/6K4l/ZziKlJXcsz/TcmUiCOcue7oNRnkIX7dQ8kZVHTNaBZw7COsjiNGtUbp1LZr1HXEbmrrJ6yHN+xWvr5AyEvad+kUGkA/H0qZfICSleJYUKCgikiWrHogpth7VzXblAOlzFbwjQvBKz3nXpAO1HtmHyXOi+Yjbphora5Y7rn7OL1R9iGuOo90/4BOlYk3xuEEPkKzZlAllUv06x/QfWUzZluWSyrP6nf5uEwlUk06y9d8pv2ufsRfMzKLQQ== 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=Myrj8CXAsR8mNT+QaE/3s7cvq2eo7BwjA25cvED55jQ=; b=A435H/aQfADgXJE9vnW4ASIJByhrqrIkym/FeIE+kdm9rZfAxutjGQeW4KXcgDz4+KxnKxfh6YYfHeMzrv5C5xMSPb0ZAzk6rCMWbiG6b+qQRB0xmzrzlNifjs6EDdYUgmHd7+sE/95AFobxsux6Y28fp0JzyokkHVxQDY8WkFwtICupI5xcAieROp1/RnzC+2zR5v4YXModPmPOjpEcnfT2QdfQ6h4tOvm4Ez/GzfQpuliGE2Y7PCJQYf0sbe07HKPB1nrqJdNbpbRqXZSZZ5fJ9e084mReMSYUtK0NCndsiUaFsu/FRahC/a5eOQt4ISCM6zfnIKYOOBaEZFazTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by PH0PR11MB4808.namprd11.prod.outlook.com (2603:10b6:510:39::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.10; Wed, 8 Jan 2025 09:20:39 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%5]) with mapi id 15.20.8335.010; Wed, 8 Jan 2025 09:20:39 +0000 Date: Wed, 8 Jan 2025 09:20:27 +0000 From: Bruce Richardson To: Andre Muezerie CC: Stephen Hemminger , Subject: Re: [PATCH v11 0/3] add diagnostics macros to make code portable Message-ID: References: <1735263196-2809-1-git-send-email-andremue@linux.microsoft.com> <1735918611-17374-1-git-send-email-andremue@linux.microsoft.com> <20250103112402.64bf2d96@pi5> <20250103212634.GA24552@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20250108024647.GA15780@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20250108024647.GA15780@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> X-ClientProxiedBy: VI1P189CA0020.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::33) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|PH0PR11MB4808:EE_ X-MS-Office365-Filtering-Correlation-Id: 450e9feb-3c1d-4722-c25a-08dd2fc5b799 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ZKoLGX6SSPYEBdz7dmZYgDPD+wnNUAQ0QA1UDmcSAUz7mM59Hb186rpE0zdN?= =?us-ascii?Q?tJzZSJ4nfTzUnxM7y2DDEo/iY770NNKtI5psK8Lo1syT8gJz4rv/Wyrf9QzI?= =?us-ascii?Q?64Ze9XQ7xUdhXwMQ7pBnNfMqCDwetxm8baF85OZnKQOjm81uOVhO/GA2CSnD?= =?us-ascii?Q?/dPMgn/nctPbkLn6txhiqoe3ou2FDDLBtgjA/PJS2W/Z5RafewYbaUik5DYc?= =?us-ascii?Q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VLTwVBLJta2sMHTUzbvKCx?= =?us-ascii?Q?lirlzEhCNn0L3/dNDa6Kt/Qu3XJKw02cPu4tA4bPYws8zAfGR3NQmClYr2wu?= =?us-ascii?Q?Ti+gFyeXLrDGP8dnNk/0cOE506Gp7chxsZP64vK2WSoeyagGFIZwjog5imXY?= =?us-ascii?Q?XraghaAMrCpiIFl2KDYZG9OUYF3D2GPes/syeP9sx4AefBSL+EGm2/6FNWAj?= =?us-ascii?Q?Z7cAlTwYQbLBtbLQr8mU5MuTFLEJ+KzPjC5cBw0FaLzUbA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(7053199007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?syXhcALI/WfYXLxyqDFB4mBr3OILqw+/SKwPOr4SwRKnJw8bnkYMkHU/3DYG?= =?us-ascii?Q?FwqgaviVUL2iqO0QjPlzCHketdW+QEEARB6XyQ8soYsiiFhEgvErqbyHCuUW?= =?us-ascii?Q?kOjbkzbW03QfKUDj0dNayGejspx1O3E35A7JYss3RoTNvP44vpoyw49e/jZY?= =?us-ascii?Q?eX0MxT8pIN0zp+ydIncYyAO2CwJgNg0HyEUVf8goB0qX3iQVyigxEhE1PHgq?= =?us-ascii?Q?+uS8+EXNZRPelzT4+lDSgvzmW0NYlUlyvpFQ0GwF832NdGr5rv0SEfIyeVsX?= =?us-ascii?Q?70bbUsO4VkxM4YAkj5kXs1fjXDJcZp3GToFAaOcUEqGVTkFPcmGu8KK9GvaO?= =?us-ascii?Q?INOioBbjl01CBTDx0gSRWRIqLLQjv3GWZVp+nTZRqLg1IUkQOx2ZNuXMN6M6?= =?us-ascii?Q?DezsrjYoyStYbuemurON3UGMlEYv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gI4RMl8SOvRmF6bjK3YODYS68lvsTC7kiKFfHSqzKjZeXhvVVkDSIx5YPUV?= =?us-ascii?Q?m8qfz2V6L62nvxpVoMsveSXGR/lFcsvagtyUPMIQ0l3mkvbxKkQTo1B7ra6a?= =?us-ascii?Q?vdNNGxOOBcFope3FSDLm3tn7qz8w5K7afoCTLv1dcD6+ezchkna098Uyqg+X?= =?us-ascii?Q?yC/OEfh0wUmG5uTMT0MppBLAYs40cNbXVFuNOpXFN2C5/7Ph+syp1EOV+sHG?= =?us-ascii?Q?QNxYFH0WVlpei7qO1a9vsrcvLsk3C47t90BBpM88un3S57znYDS78lUlkEVy?= =?us-ascii?Q?Vg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 450e9feb-3c1d-4722-c25a-08dd2fc5b799 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2025 09:20:39.4417 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: owyXS2DrWkHYGcWXOVBBfybyys3cHfBYxUPdwESEL+zBhNfWp5VDHy+xwyzewXYhnyoxccIU6WIEnn2ZvsCt3Uvjk75zDIlhYv4xHzq/QX8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4808 X-OriginatorOrg: intel.com 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 On Tue, Jan 07, 2025 at 06:46:48PM -0800, Andre Muezerie wrote: > On Mon, Jan 06, 2025 at 11:00:15AM +0000, Bruce Richardson wrote: > > On Fri, Jan 03, 2025 at 01:26:34PM -0800, Andre Muezerie wrote: > > > On Fri, Jan 03, 2025 at 11:24:02AM -0800, Stephen Hemminger wrote: > > > > On Fri, 3 Jan 2025 07:36:48 -0800 > > > > Andre Muezerie wrote: > > > > > > > > > From: Andre Muezerie > > > > > To: andremue@linux.microsoft.com > > > > > Cc: dev@dpdk.org, stephen@networkplumber.org > > > > > Subject: [PATCH v11 0/3] add diagnostics macros to make code portable > > > > > Date: Fri, 3 Jan 2025 07:36:48 -0800 > > > > > X-Mailer: git-send-email 1.8.3.1 > > > > > > > > > > It was a common pattern to have "GCC diagnostic ignored" pragmas > > > > > sprinkled over the code and only activate these pragmas for certain > > > > > compilers (gcc and clang). Clang supports GCC's pragma for > > > > > compatibility with existing source code, so #pragma GCC diagnostic > > > > > and #pragma clang diagnostic are synonyms for Clang > > > > > (https://clang.llvm.org/docs/UsersManual.html). > > > > > > > > > > Now that effort is being made to make the code compatible with MSVC > > > > > these expressions would become more complex. It makes sense to hide > > > > > this complexity behind macros. This makes maintenance easier as these > > > > > macros are defined in a single place. As a plus the code becomes > > > > > more readable as well. > > > > > > > > Since 90% of these cases are about removing const from a pointer, > > > > maybe it would be better to have a macro that did that? > > > > > > > > Would not work for base driver code which is pretending to be platform independent. > > > > > > Most of the warnings I've seen were about dropping the volatile qualifier, like the one below: > > > > > > ../drivers/net/i40e/i40e_rxtx_vec_sse.c:42:32: warning: cast from 'volatile struct i40e_32byte_rx_desc::(unnamed at ../drivers/net/i40e/base/i40e_type.h:803:2) *' to '__attribute__((__vector_size__(2 * sizeof(long long)))) long long *' drops volatile qualifier [-Wcast-qual] > > > 42 | _mm_store_si128((__m128i *)&rxdp[i].read, > > > | ^ > > > > > > To make sure I understood your suggestion correctly, you're proposing to replace this > > > > > > __rte_diagnostic_push > > > __rte_diagnostic_ignored_wcast_qual > > > _mm_store_si128((__m128i *)&rxdp[i].read, dma_addr0); > > > __rte_diagnostic_pop > > > > > > > > > with something like this? > > > > > > _mm_store_si128(RTE_IGNORE_CAST_QUAL((__m128i *)&rxdp[i].read), dma_addr0); > > > > > > This could be done, and I think it does look better, despite the slight line length increase. > > > > +1 for this option. One macro can be used to drop all qualifiers, both > > const and volatile, right? > > Yes, a single macro can drop all qualifiers. I did realize though that the macro must involve the entire expression - it cannot be used just around one parameter, unfortunately. > For many use cases, those involving pointers, the qualifiers can be cast away by passing through a uintptr_t. Just tested this with gcc and clang: volatile int x = 5; int *y = (int *)(uintptr_t)&x; printf("*y = %d\n", *y); works without warnings or errors. Does this similarly work with MSVC? If so, we can do a macro specifically for pointers types, which should cover 99% of what we need. /Bruce