Received: by 10.213.65.68 with SMTP id h4csp4419914imn; Tue, 10 Apr 2018 14:46:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+vOq9hxVr5ach+fLOsBe02iMEtj9bx4dLfs1bpHXUOaOSCtDcuoW+dJhtmOnzUsoDOTi2e X-Received: by 2002:a17:902:8c84:: with SMTP id t4-v6mr2116482plo.357.1523396795277; Tue, 10 Apr 2018 14:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523396795; cv=none; d=google.com; s=arc-20160816; b=m20Jp0hGdC9jORi2Nq4aWtUYcFzP//Z3NnyBJaJgs3cXbesE23WEM7Xlhg+ryUiR4d Gu4a7hIL+SUCH7tZcOdHGIqnnYe9OI5dm0mgUDBxkY5eqj/KlJ/utP6/FprM1STzU3Wd 1aqDhuSqxDrPoZvMxnWMx7sv7QCXryfz0aRl3BvCc1clD0SLcI756mG5p0/AXxNHvNhV 785NPG4QCiF5kJ7hYwPUlnxxsFFTvOg5pcHeV1P4BakfQeDmN9ROicEyTSBja7tbObVf /Gy8zX/+byVKFPDVWHTf9UxPIKb96LRSiF5zcnzps/V8+3D1QtiObAnwYbN0dIBvz7Ib VGOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=oi0VK4rONCXotulIxleVyAVmgIn1b4AN5kH49EJpw7I=; b=QvWzuuJrqJpat858EWIxVQjV45jiiu2Jb9kmJD5zFloigp5WmHs8ARowBmmwttNmrO /HD2wNPt1qq8zwvi2TfVwZBB4If88oGpsEvh9cGE45Y8K2B9d62Y47pPi2EV7HGuWvkk B2wYpCRvDweHBzDd53X4+kA0mc1PK+FlfDXWqTnZeYTNB6s/7fSycoF+0x7FE/4sha2y WrNFVmJ78dEWtfHMrVR8GqnSWEdv1g5WjUgD0Ikw6sbw41rm5OhlyDljNQWZtnXFJV4G yjTCcGFxCzmHPOcmBbCA5RU+WKei0sC8he/ZOCJvYPlIS+tMvuaX7iyUoFEUI0cc71VH xy4A== ARC-Authentication-Results: i=1; mx.google.com; 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 f8si1614864pgr.419.2018.04.10.14.45.50; Tue, 10 Apr 2018 14:46:35 -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; 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 S1752392AbeDJVjx (ORCPT + 99 others); Tue, 10 Apr 2018 17:39:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54376 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751876AbeDJVjw (ORCPT ); Tue, 10 Apr 2018 17:39:52 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.71]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A66D3E09; Tue, 10 Apr 2018 21:39:51 +0000 (UTC) Date: Tue, 10 Apr 2018 14:39:50 -0700 From: Andrew Morton To: Joe Perches Cc: Peter Zijlstra , "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: <20180410143950.4b8526073b4e3e34689f68cb@linux-foundation.org> In-Reply-To: <95477c93db187bab6da8a8ba7c57836868446179.camel@perches.com> References: <891d4f632fbff5052e11f2d0b6fac35d@codeaurora.org> <20180410123305.GF4082@hirez.programming.kicks-ass.net> <95477c93db187bab6da8a8ba7c57836868446179.camel@perches.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > So emit a message on the use of bool in structs only in .h files and > not .c files. > > There is the real possibility that this test could have a false positive > when a bool is declared as an automatic, so limit the test to .h files > where the only false positive is for declarations in static inline functions. What's wrong with bools in structs? The changelog should be self-contained, please. At least add a link in the changelog (of the lkml.kernel.org/r/MSGID variety), but a link in the changelog is risky because the reader may be offline or the server may be down. > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -6257,6 +6257,13 @@ sub process { > "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr); > } > > +# check for bool use in .h files > + if ($realfile =~ /\.h$/ && > + $sline =~ /^.\s+bool\s*$Ident\s*(?::\s*d+\s*)?;/) { > + CHK("BOOL_MEMBER", > + "Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384\n" . $herecurr); And... the server is down. Am unable to understand or review this patch! > + } > + > # check for semaphores initialized locked > if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { > WARN("CONSIDER_COMPLETION",