Received: by 10.192.165.156 with SMTP id m28csp434381imm; Wed, 11 Apr 2018 01:19:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx49poWDn/sh6z7BtTajWQ2uQbd+mYNxglgCT01mMGSxl2kKsurNA/PK3useniUrvKn//gwR6 X-Received: by 2002:a17:902:7007:: with SMTP id y7-v6mr3906800plk.227.1523434758600; Wed, 11 Apr 2018 01:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523434758; cv=none; d=google.com; s=arc-20160816; b=ksQoBSztxkiDVy7iKvyrKopZJLGi3dYnh6dU9Wo06dHmVtcbUGCt0lM/tSNYDZOC69 ontwuTku7nzTe6AvahPH0og4DEOmizoCbspgtsCBaUcMbP5GhcsoCws1Oms496OOO8gk 4yCAugWHrrSYmmkr+vM6wYIR8AIp029a7FnLEdwK7CokKIjgvYmHz7ARUj6vv0sSnaiC J2iLwHMBEZZMWAhDoZgbd0xqiqSQQASAO4Lwbn4nlxTYASAGNV0UqehASHmjzYmce7vg kqm0LKvHtB6tW9HdPXGemC8uze+04zyXgZC7Nc/AfRCLnbbyYv63W2lvmYwhBL/An/Di W0mQ== 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=SpavD7oN/s/eEWpqFfl7mnzLn7rJyckLRH8Os5f/bSI=; b=c86+NB+E33vD8VSFY1AlEk7gdMCaUBotdRsdU0MwVnxhSBEFyMS1Osjr5ODQH5IK3K +22xzbqJMF8I9VkKZTGc4Iv0ZYXYh2HQ1XTNgFu1RBU2v2kqDK8Hl+v7mqHGBJ38iISD PFKRs/MIKuMyfosvBASjYLW2poyIytvFKnNgnCpqwyYD8WCHmGleYywGk3siKw5zq1FK MyEW127N7rWWRy/vGtArnzPV2TrFYZQZQIr8WGKtUwc+Vz4qSh6v2mmqze/0g9nEg5uU 7xoFJyzQ8qGl7GqyIiqdwkOCjheJNio6TYIupI5JNwIYEaT9Hxw2iE36447HAo9F3MEH QXtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=s3SkQBen; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v45si401375pgn.379.2018.04.11.01.18.41; Wed, 11 Apr 2018 01:19:18 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=s3SkQBen; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751972AbeDKIP0 (ORCPT + 99 others); Wed, 11 Apr 2018 04:15:26 -0400 Received: from merlin.infradead.org ([205.233.59.134]:43622 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750825AbeDKIPW (ORCPT ); Wed, 11 Apr 2018 04:15:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SpavD7oN/s/eEWpqFfl7mnzLn7rJyckLRH8Os5f/bSI=; b=s3SkQBenju9MpTroNHYdTXPT+ uhzgYuJPEG/5K75xAtBPPmz1A1Bj4m47ddYZvSbE/XEwKK8J8SSaEscEXLndFq67RVkq9oGvcEPxt WPDUAbfdQfRwqcN2PtU+4USPcCDsffG2Atk+YLge50GqvUzGbPThkbzgOg8F+HlglBU504V+A0v/O MpuDNNGQNhn5YzOrZ3mHd/XwQBtZCdO6NuyUYXc34wWDU9ONYLscYBil/Cc58UDjhEv6a4ONv2rpH sZ9GJXiGT126gyRomEByYviUsKvY6RIIdiDb5oG7YjlhuAOdLLwvSHHbegpVbl66wKXQJFdzjMF56 /mXw8bkYw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6AuH-0008Kb-3W; Wed, 11 Apr 2018 08:15:05 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5161E202A29FD; Wed, 11 Apr 2018 10:15:02 +0200 (CEST) Date: Wed, 11 Apr 2018 10:15:02 +0200 From: Peter Zijlstra To: Andrew Morton Cc: Joe Perches , "Rafael J. Wysocki" , Andy Whitcroft , yuankuiz@codeaurora.org, Linux PM , "Rafael J. Wysocki" , Frederic Weisbecker , Thomas Gleixner , paulmck@linux.vnet.ibm.com, Ingo Molnar , Len Brown , Linux Kernel Mailing List Subject: Re: [PATCH] checkpatch: Add a --strict test for structs with bool member definitions Message-ID: <20180411081502.GJ4082@hirez.programming.kicks-ass.net> References: <891d4f632fbff5052e11f2d0b6fac35d@codeaurora.org> <20180410123305.GF4082@hirez.programming.kicks-ass.net> <95477c93db187bab6da8a8ba7c57836868446179.camel@perches.com> <20180410143950.4b8526073b4e3e34689f68cb@linux-foundation.org> <20180410150011.df9e036f57b5bcac7ac19686@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410150011.df9e036f57b5bcac7ac19686@linux-foundation.org> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 10, 2018 at 03:00:11PM -0700, Andrew Morton wrote: > On Tue, 10 Apr 2018 14:53:51 -0700 Joe Perches wrote: > > > On Tue, 2018-04-10 at 14:39 -0700, Andrew Morton wrote: > > > On Tue, 10 Apr 2018 11:19:54 -0700 Joe Perches wrote: > > > > > > > A struct with a bool member can have different sizes on various > > > > architectures because neither bool size nor alignment is standardized. > > > > > > What's wrong with bools in structs? > > > > See above. > > Yeah, but so what? `long' has different sizes on different > architectures too. Right, so we have ILP32/LP64 for all our 32/64 bit archs respectively. So only 2 possible variations to consider, and if you know your bitness you know your layout. (+- some really unfortunate alignment exceptions, the worst of which Arnd recently removed, hooray!) But neither says anything about sizeof(_Bool), and the standard leaves it undefined and only mandates it is large enough to store either 0 or 1 (and I suspect this vagueness is because there are architectures that either have no byte addressibility or it's more expensive than word addressibility). Typically GCC chooses a single byte to represent _Bool, but there are no guarantees. This means that when you care about structure layout (as we all really should) things go wobbly when you use _Bool. If GCC were to guarantee a 1 byte _Bool for all Linux ABIs we could reconsider.