Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3651302pxf; Mon, 22 Mar 2021 11:27:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyib23giTNieVyKUMpo0316+QXa0FZ73IJkmUdq8i3Q9/B4H7NoHQaY2kUoDegHsrLLbbYC X-Received: by 2002:a50:fd15:: with SMTP id i21mr929674eds.384.1616437642082; Mon, 22 Mar 2021 11:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616437642; cv=none; d=google.com; s=arc-20160816; b=rZYYPGvT/X1nH8sFgu16D+obzluF4LswgqhHGz7o1MMj8kIOS+pHMKy5SyFqBtLVgR VFyzEFiYSe3wjXVgnhuTif7Go5Im2qXkKbug/Y3ydOj58B4ExWd3VZgJZo437PmRPWX3 TFw8uH8iWG+koCLbfl8R8MTMyHJY23OxHwDv1wjVIl97HNDUgT816iX/ZBB0KmHWYFjD i6+cmvQgkfqPm5uB5PKU6NAsvW3FrfvexVlBEW9qd5JpwpSitdrDrjRf5crq7sI1z2a+ UZMfiDamoXnvn0pILvsD7iRyNXqk6lPPMWIoJdTqq6gWiB6naSh0k3CC9D72hDWOpkDv 17qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SjR3jBX4oXpECiWlGsWcXSYopsBwrML//l6T6CEQQHo=; b=BPoXydgvjVowWrB/9UvnXTqjdKej0eX2m/6xkS+yN5NL5+FFjrFmidP/kIMpMsqxp/ lPxA7El5fETREv1RRrS8zlme7OgjPgkYbOvKA0FVb2BVyN+fUkYoMcbTb6CuhEbFXCsK R5CyzszKGJh5pmemNulx7kH3v+WYwqsQ6au7BpOnTAxZLp8iH1xgQma7vmLLBR6gOfdF u4+pQMYcmhe4tE+68/DU+xCt4MXSBj3fOYthMo54teE1aOMJz/Pj9+uZcP4YGNWTNEl0 nS1pKcm+VpCV3NOLTd6EyuiT/2DzZx3R2q75qCblmLu8FpVKCFltBmXzfXnicLHLyIbq ILag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PJXdo49I; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si12309812edd.474.2021.03.22.11.26.59; Mon, 22 Mar 2021 11:27:22 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PJXdo49I; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232057AbhCVSZj (ORCPT + 99 others); Mon, 22 Mar 2021 14:25:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:56816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232164AbhCVSZI (ORCPT ); Mon, 22 Mar 2021 14:25:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 323A061992 for ; Mon, 22 Mar 2021 18:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616437508; bh=btqPrkynhxzXV4lNizFKA3/kG4DsBvvwKnGEdTnojHw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PJXdo49ICbPSsITEAeQ6RstshMpvA4bQOA5aXO2KyXuXW+ie1kMYpA1Y6j6//8BAz OaMv3m/Zk64SfVvoYvo7S9hKBN43at0Bqh5yDM0HCxQ0IHTjymLcE3A7wDzgQbAdFP bi/q50XgQGAdQjx4bSWlorzGltEccgyBXJXRErEX1F1oejbxYqdOy9WXG4ZcWqH+6I XSTqGG/m5zocu1YP9SrpFf/zB9cVVjTs2HG99c7HQ20X+pqjdYCq//ORfwPS46gwnU ZhgKIqK4Dg4AnsyuQuwBXHvjoCJNt4PaTjvWPHre4LPCW7SVn3vXGFO/V/dBmepbZi W4n0i9aWyzrnw== Received: by mail-oi1-f171.google.com with SMTP id k25so14047387oic.4 for ; Mon, 22 Mar 2021 11:25:08 -0700 (PDT) X-Gm-Message-State: AOAM530kb4WRIDXYg+znGXh249y5psVNNcmRtzHIsmvrST25Q7Erv8Um JdcA+PasajxVm+5ZC6zpj4maxW0/k92rTzcdHrA= X-Received: by 2002:a05:6808:3d9:: with SMTP id o25mr322031oie.4.1616437507486; Mon, 22 Mar 2021 11:25:07 -0700 (PDT) MIME-Version: 1.0 References: <20210322114536.3517661-1-arnd@kernel.org> <20210322143344.GN3141668@madcap2.tricolour.ca> <20210322175821.GO3141668@madcap2.tricolour.ca> In-Reply-To: <20210322175821.GO3141668@madcap2.tricolour.ca> From: Arnd Bergmann Date: Mon, 22 Mar 2021 19:24:51 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] audit: avoid -Wempty-body warning To: Richard Guy Briggs Cc: Paul Moore , Eric Paris , Jules Irenge , linux-audit@redhat.com, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 6:58 PM Richard Guy Briggs wrote: > > On 2021-03-22 17:28, Arnd Bergmann wrote: > > On Mon, Mar 22, 2021 at 3:33 PM Richard Guy Briggs wrote: > > > > Change the macros to use the usual "do { } while (0)" instead, and change a > > > > few more that were (void)0, for consistency. > > > > > > So what about audit_put_watch() and audit_get_watch() which are set to > > > {}? (And all of include/linux/audit.h that uses the latter...) Does > > > this only matter if they are the only action called in an if or loop? > > > > I missed those, thanks for pointing it out. I sent a v2 patch now. > > Ok, cool, that looks more consistent. Can you answer my question about > include/linux/audit.h and exactly what conditions require > "do { } while (0)" over "{ }"? This is the usual way of constructing a C expression that can be used e.g. in if (x) foo(); else bar(); If foo() is defined as '{}', this causes a syntax error. Arnd