Received: by 10.213.65.68 with SMTP id h4csp3179979imn; Mon, 9 Apr 2018 15:55:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+30kLyx1uy/QaE9xIeh2PoC84qqX8S9KpNQuGNT96+bYsg72yqDAKTllpXghPWqH1A0A91 X-Received: by 2002:a17:902:aa0b:: with SMTP id be11-v6mr30652379plb.36.1523314557048; Mon, 09 Apr 2018 15:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523314557; cv=none; d=google.com; s=arc-20160816; b=08uHb1kjVQx1hM1hFdYTJi7ud3AmTq475QQDtzfbrQyXELtNTP4V29Pru4qSHX1y6V DeQwhWXz7Cqq60zrarBlVWWFHetksHGGjTdbTIWs6xFQrWg9duDWtAgCPs2nA2vhBzzm dMvFnJprpC8p5FSkQFs6xVQ4ZzvEUBpPtHwQtyptHm3Jdmo2AWm83TorB6xW/6u1wlOF Iv9PD03n4p9nUFFKYgAxn6Zud1SbR4WzU/CCj+gJYIl2QCUdkP72Zz6mje2D9KrRWoBo KjfG+tXTjYE+PA6HaJpfVkwv3GuBVl0awTgGvm0bqAvc0BbXY/jZLNSj7oshDyAKL2gd 6HMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=btUAUz2jECAiSAYu84bwMvFfH828bP6GjpvvLoJy5ts=; b=RWaaA7CSe2NNVpVKmEDi3VBq9Q0BMuJeFARLHxF4kRWbcIGDkXIsqmUZDb/euv1o7X bzPFTe0FC7w0HPn1UpSLAA7D/E4UztaqyeGqee1vYhpuqywlE1uVZSKiBmdWr1gOEN1N RnPHxSMhGO9Znp7W6jOLteYieol+GoPrFob9pCHFVPNHgC4awvKDTijIhEfxBNizXY5P cd5p+OP6VZL+6cgvRrBECvRXWj3RhtX+Ifbi6BxmRlFaGgH3GmYfKO4G+kSvIaeKfphw 8uQAloUB9QjnVVAu+euqZIDbeWDFvqb/SH+UjG+rKW04tkH3PeaothFykknVY6vY+WgZ uUug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F7UT5a6v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r39-v6si1105124pld.307.2018.04.09.15.55.20; Mon, 09 Apr 2018 15:55:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F7UT5a6v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751991AbeDIWvS (ORCPT + 99 others); Mon, 9 Apr 2018 18:51:18 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:33046 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750982AbeDIWvP (ORCPT ); Mon, 9 Apr 2018 18:51:15 -0400 Received: by mail-pl0-f67.google.com with SMTP id s10-v6so6106190plp.0; Mon, 09 Apr 2018 15:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=btUAUz2jECAiSAYu84bwMvFfH828bP6GjpvvLoJy5ts=; b=F7UT5a6v684Pe1ftVpY77xEluK4QLtu2M3pSVrmUyBrUjVeyiVhg/L7iDExIC2AgJz DEcjTVltxJMEP73tNOgHJt8Dv5eHSX0KsM5yWpNSGX359jEN7845KxGzMeu8gZdlkML7 xxZ/S0twbpni4VATbhy/DVDFuSi2NnrwHWfQTy/4jHgL5I+reyUa8OHrOIhIuW8R+7FN wreXr8rSTN6K/rol2Y5TefYMq2YziJY4BwnTiVrAa50Ng8eNbOchkwQ8mRNBx2/47JDi m75qi8SCFcLmEcUbkLBqeeS3vROwgzm3qY22E3vYQ3CSJi09GYx7wmItP0owH7MIyJGr MGqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=btUAUz2jECAiSAYu84bwMvFfH828bP6GjpvvLoJy5ts=; b=JYrnXHrI3/LI6qoUAyapStT0TuoWM+WvU3BITs0UJPKjtXmVmup+WQtfSN13bD967o fu8mpWO47NMgTMNGgBjmymAJEUJ6LgXeODOAwIYXuN6awXOx4qDdSt3z3Kie9kZxxhXM oy/RvP0o6xVju5S3mgVsr3tc/BgQER3CLp9P7vSO7DsOwjxiz864VXIiAC7AJ+KZgGED bqeb8VS6vAko75nnFKf+Thvrq1GLRnD2+FJrzwFe7kcm5AOofQLpaezFZnbRqA3vFsUy EpOnVXRlSEp+zoRzVnkRTJK7Vi3XDnoDfCdTEBf71c3K8UkB8XXakodp1GcFilHBM4wK JGKg== X-Gm-Message-State: ALQs6tDIwaOwtVtDRu2pArf7M40KX19fykL8qmwf14Y0trW7fPBnEmQo cLY/HVNfUqw3yVYLOlpQYUk= X-Received: by 2002:a17:902:b90b:: with SMTP id bf11-v6mr3550674plb.399.1523314275201; Mon, 09 Apr 2018 15:51:15 -0700 (PDT) Received: from gmail.com (cpe-98-150-136-16.hawaii.res.rr.com. [98.150.136.16]) by smtp.gmail.com with ESMTPSA id k24sm2329898pfj.32.2018.04.09.15.51.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Apr 2018 15:51:13 -0700 (PDT) Date: Mon, 9 Apr 2018 12:51:01 -1000 From: Joey Pabalinas To: Luc Van Oostenryck Cc: Joey Pabalinas , linux-sparse@vger.kernel.org, Kees Cook , Linus Torvalds , Martin Uecker , Al Viro , Christopher Li , Linux Kernel Mailing List Subject: Re: [PATCH v2] add -Wpointer-arith sparse flag to toggle sizeof(void) warnings Message-ID: <20180409225101.uzztpdv6bbjmlwwr@gmail.com> References: <20180407215805.ze5rx4v3slbjngmo@gmail.com> <20180408074823.fgrmtrjzzjb7dlt2@ltop.local> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="i66hledbarrby5xx" Content-Disposition: inline In-Reply-To: <20180408074823.fgrmtrjzzjb7dlt2@ltop.local> User-Agent: NeoMutt/20180323-62-378db9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --i66hledbarrby5xx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 08, 2018 at 09:48:24AM +0200, Luc Van Oostenryck wrote: > With the warning disabled by default (for the moment), I had to adapt > the testsuite with: Ah, so should I include that change in the patch itself when I make a V3? > > +Warn about anything that depends on the \fBsizeof\fR a function type o= r of void. >=20 > Maybe it would be useful to add something along the line of "like directl= y using > the sizeof operator on void or doing pointer arithmetic on a void pointer= " ? I actually just took the explanation straight from the GCC man page since I figured the explanation should match (as the flag itself is basicallt copied). But I do sort of like your wording of it more, so if no one else sees any reasons to _not_ to diverge from GCC's wording here I have no problem changing that. > > +Although non-standard (and somewhat illogical), constructs such as \fB= sizeof(void)\fR > > +are often useful when the intent is to operate on an expression withou= t evaluating > > +it, e.g. in the following integer constant expression predicate: > > +.nf > > +#define __is_constexpr(x) \\ > > + (sizeof(int) =3D=3D sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)= 8))) > > +.fi >=20 > I think that pointer arithmetic is much more useful than taking the size = of void > (being able to take the size of *any* thing is somewhere in the middle, I= MO). > But in all case, I don't think this part should belong to the man page. Also have no problem eliding this section if no one else has any good arguments for keeping it. --=20 Cheers, Joey Pabalinas --i66hledbarrby5xx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKlZXrihdNOcUPZTNruvLfWhyVBkFAlrL7lUACgkQruvLfWhy VBnHJBAA4WrMvWURAGnDzncmmRN07OZHpuNfKomQbaA5o0dTWHJH0rJIf5LI1X+d hZEGRCMHQxADDjzX0auwV9yR8OrTLyD8zUIRQcTLCdNEhbWIdHqEoVGzokx49v7z lm6Pe/ng0XODMcAwWI6jDIe0i66gngrfnfO6UN1YxxzNRYOvb30tmEizrEA6nFzT y60HMnCR+mqeAYQ1AFVQjJeyXLHgEMekjrXGtXR1Q1rqCRzftp8S/VRQFN6zgDsL paKuocXfJnvM+RCiMSsPS3I5dvhWMHldKCbaYIZL5XwtQyZKS1aU7RUbzkXpzrJf dwa6l6dkcgFcji9wNJAtf9X4+8bH+/bb39OhdmhY9LtBAjR5M+7eRaTscppBctwW ZmASbkStWqaUCInz9X1MFpLsGny0KeMYLONreFuXMniCFzevTk5L40QdmgTGGxTM d/U2SiRWn6Bse3RwIG4gs5qemxQ8PMcSpy0algO742WTVukRZJi9lg290311XUqd Z6KG2fMpIcZ3yt5xEYjq55QOdaBTeo1oAw/JpkHC6kRP3BWyECtjh/DsgNbTNA2m nhXibBGbnGUGEfLgsPoCXsZzVfJJt1oUSyOcBCWdcDD4oeWyCKcrHPprHBZHwd4T +hzGcnQ8O9mBqoey51t+t8MuiHVGh4MwOlYLopKuWEjdeGpzuT8= =XiYb -----END PGP SIGNATURE----- --i66hledbarrby5xx--