Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4869817pxb; Tue, 5 Oct 2021 12:07:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNe2KvnfOwlMvRDMBCYeFJRH0jb4n7bxq3Ezh1IIORoKdoQNWKjH0puGieIS05S6HFsIHG X-Received: by 2002:a17:90a:62ca:: with SMTP id k10mr5728685pjs.38.1633460874043; Tue, 05 Oct 2021 12:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633460874; cv=none; d=google.com; s=arc-20160816; b=qWYUKT9e1FYAHOr17addUooJh84rYelMLeS+IYTPZc1thto7vs3QBlQ9NX2Pz823Wr ny82z8B/aihp9/62f0BMnVj7eQoOI7bjX+z6c4hBy0FmaW2NS8VLHpA+cM8hg6aa031T VzVCwQ9ydGo1Pqv0xhRJlz+TlFQBsM4V4T/g3nbSbvkoLhGD9g5aahCbWNFH1b1MxPz9 19GmNpn4rrAlAk365stec+geStwpqbrfMNhC/2kziP64jI+X1smE9ymsqxU/zb4diDux AZQEPt3TuECwPBY4S+uSiFqfoQAu3pd6nOJFA1Jua7Cmpbp0YllpZqvF3+cN7sDe/pk5 n95A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:message-id:in-reply-to:subject:cc:to:from :date; bh=Y/F46/76rn+dFee4DhlIThw+EfWnidiRF/F98RMQyLg=; b=Mohy05T3lNNowJJwztBzfrPq9iiPoWpBaILivCu53Ecc+CNvCsppMQp13oX06MrKLr i0h3b1oDrvB9mdPkXEFPTr+QMA0YL3Ghv7xnT/NIWaTqKnPqHQ4QymlehGHjK6lM9dFQ K7GRNY6d+DGD+xBoK91Pj7upJqH6WpzzNgxzfWNZWWeCCoKuLgg2oWQwFbTumKMoxplT LQFTGUar7AXCT0frj9ipHJZ3Iug4rsWaVLLtpuMcVCZh8QS9DLgUWqRQkSsWuGIxo+gs TmrIVYFKPTtOMussNB7VNKLGFK/6Eak3tVgET6SmJ+DgXVNIr47CYzOYVhst0sEgq145 1sYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y12si32562272pfa.82.2021.10.05.12.07.38; Tue, 05 Oct 2021 12:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235206AbhJETI3 (ORCPT + 99 others); Tue, 5 Oct 2021 15:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbhJETI2 (ORCPT ); Tue, 5 Oct 2021 15:08:28 -0400 Received: from a3.inai.de (a3.inai.de [IPv6:2a01:4f8:10b:45d8::f5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3739C061749; Tue, 5 Oct 2021 12:06:37 -0700 (PDT) Received: by a3.inai.de (Postfix, from userid 25121) id 21E7D5877C256; Tue, 5 Oct 2021 21:06:36 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by a3.inai.de (Postfix) with ESMTP id 1DD7B60C1CB34; Tue, 5 Oct 2021 21:06:36 +0200 (CEST) Date: Tue, 5 Oct 2021 21:06:36 +0200 (CEST) From: Jan Engelhardt To: Steven Rostedt cc: Mathieu Desnoyers , Rasmus Villemoes , linux-kernel , Linus Torvalds , Paul , Josh Triplett , Lai Jiangshan , "Joel Fernandes, Google" , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , rcu , netfilter-devel , coreteam , netdev Subject: Re: [RFC][PATCH] rcu: Use typeof(p) instead of typeof(*p) * In-Reply-To: <20211005144002.34008ea0@gandalf.local.home> Message-ID: References: <20211005094728.203ecef2@gandalf.local.home> <639278914.2878.1633457192964.JavaMail.zimbra@efficios.com> <826o327o-3r46-3oop-r430-8qr0ssp537o3@vanv.qr> <20211005144002.34008ea0@gandalf.local.home> User-Agent: Alpine 2.25 (LSU 592 2021-09-18) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 2021-10-05 20:40, Steven Rostedt wrote: >> >> >>>> typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); >> >> #define static_cast(type, expr) ((struct { type x; }){(expr)}.x) >> typeof(p) p1 = (typeof(p) __force)static_cast(void *, READ_ONCE(p)); >> >> Let the name not fool you; it's absolutely _not_ the same as C++'s >> static_cast, but still: it does emit a warning when you do pass an >> integer, which is better than no warning at all in that case. >> >> *flies away* > >Are you suggesting I should continue this exercise ;-) “After all, why not?” typeof(p) p1 = (typeof(p) __force)READ_ONCE(p) + BUILD_BUG_ON_EXPR(__builtin_classify_type(p) != 5);