From nobody Thu Dec 18 00:30:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678293618; cv=none; d=zohomail.com; s=zohoarc; b=gMFMvGXoSMfXTDwcdfJHlQJq86m+xY0uaALOzzA0iNsBLe8yJnrs1rCRO06JHvb7QXI90dTexjxdeCW4Aj9dVa0Ntik8QEjsCNYqKCK7TmUro+unacI/n2lTWdFUzI8kMiup9RBRCQEKGfvJl9UjueK4YYpEpJQqSJ3ALIQbpI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678293618; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XhENEKNrnAnjuUTSubBYUUKGceBSdvQB/5mWvV9Q+pQ=; b=Lxk2iFY7ZP8uJ+Hz5olXO+/eg/RM07vw3ZHlGqmaLcAi6YKl1FuFvaDU3MG4rzJZUN9I0RBlxsrC2EW5hXqr4zJDR4R0QggjNw3beGM6D53dQ6hCY5NBTRAYZ2b1V6pbBTl+LeVbiokwM3n80NLp90XXfBjg9655OqtZEffC5OE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1678293618093783.3241163522908; Wed, 8 Mar 2023 08:40:18 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-GOmykwK3P-2NWdfn-E_1XQ-1; Wed, 08 Mar 2023 11:39:41 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95B0B100DEA5; Wed, 8 Mar 2023 16:39:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F7D52026D68; Wed, 8 Mar 2023 16:39:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B41BA19451FB; Wed, 8 Mar 2023 16:39:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E023C19465B5 for ; Wed, 8 Mar 2023 16:39:17 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D50B8112132D; Wed, 8 Mar 2023 16:39:17 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB51A1121314; Wed, 8 Mar 2023 16:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678293617; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XhENEKNrnAnjuUTSubBYUUKGceBSdvQB/5mWvV9Q+pQ=; b=BDNKvHkluqyI7hCp2XuPVCoVcRHOkriUALTRaFFeuwgdN4Jvm3sT+NzZ1GGOknTGT3tQqD YJAD9DWi8IQVNg9q7HUH6on8orVLyX//XgHUZib0euRAyKb44XDUpqS4V6zSABehqMAsKS bw8/qSd0QejU+qehClgtQQ5r2rlEuvE= X-MC-Unique: GOmykwK3P-2NWdfn-E_1XQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [PATCH 01/16] rpcgen: drop type-puning workarounds Date: Wed, 8 Mar 2023 11:38:58 -0500 Message-Id: <20230308163913.338952-2-berrange@redhat.com> In-Reply-To: <20230308163913.338952-1-berrange@redhat.com> References: <20230308163913.338952-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678293618905100002 The current RPC code is post-processed to introduce an intermediate variable, rather than casting directly to char ** at time of use. This is said to be a workaround for type-puning warnings that the compiler emitted. Neither GCC or CLang emit any warnings for the code in question today, across any of the architectures we test in CI. Thus it is presumed that somewhere in the 15 years since the workaround was done, the compilers have got smarter and do the right thing. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/rpc/genprotocol.pl | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index f567260588..079627964f 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -92,29 +92,6 @@ while () { @uses =3D grep /[^.>]\bi\b/, @function; @function =3D grep !/[^.>]\bi\b/, @function if @uses =3D=3D 1; =20 - # (char **)&objp->... gives: - # warning: dereferencing type-punned pointer will break - # strict-aliasing rules - # so rewrite it. - my %uses =3D (); - my $i =3D 0; - foreach (@function) { - $uses{$1} =3D $i++ if m/\(char \*\*\)\&(objp->[a-z_.]+_val)/i; - } - if (keys %uses >=3D 1) { - my $i =3D 1; - - foreach (sort(keys %uses)) { - $i =3D $uses{$_}; - unshift @function, - (" char **objp_cpp$i =3D (char **) (void *) &$_;\n"= ); - $i++; - } - @function =3D - map { s{\(char \*\*\)\&(objp->[a-z_.]+_val)} - {objp_cpp$uses{$1}}gi; $_ } @function; - } - # The code uses 'IXDR_PUT_{U_,}LONG' but it's wrong in two # ways: Firstly these functions are deprecated and don't # work on 64 bit platforms. Secondly the return value should --=20 2.39.1