From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59676C4332F for ; Wed, 5 Oct 2022 18:54:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbiJESyI (ORCPT ); Wed, 5 Oct 2022 14:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231444AbiJESyB (ORCPT ); Wed, 5 Oct 2022 14:54:01 -0400 Received: from smtp-bc0a.mail.infomaniak.ch (smtp-bc0a.mail.infomaniak.ch [IPv6:2001:1600:4:17::bc0a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A04F6E8AB for ; Wed, 5 Oct 2022 11:53:59 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MjNyY57T3zMqGXm; Wed, 5 Oct 2022 20:53:57 +0200 (CEST) Received: from ns3096276.ip-94-23-54.eu (unknown [23.97.221.149]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4MjNyX6tDfz3k; Wed, 5 Oct 2022 20:53:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1664996037; bh=ljZRze/N/m9CPBbrjY5RWsT55yRxL6hGaxZnan724g0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JKxnmzq8JABtbqJNCp8orWwIluxUpJ41CZjEHY7+0VnddzsxzFPkYAcwDMjtaUC61 qPX474+zaDpme2A4BX4yyYKV4NeX+kSuq28NpVxnMV3uXBQx28G7P/lGXcbDQb1Z3D eppc2o1jWMFhIP28VdJHVKq31RHpxOOyg4UlbpME= Message-ID: Date: Wed, 5 Oct 2022 20:53:56 +0200 MIME-Version: 1.0 User-Agent: Subject: Re: [PATCH v8 2/9] selftests/landlock: Locally define __maybe_unused Content-Language: en-US To: =?UTF-8?Q?G=c3=bcnther_Noack?= , linux-security-module@vger.kernel.org Cc: James Morris , Paul Moore , "Serge E . Hallyn" , linux-fsdevel@vger.kernel.org, Konstantin Meskhidze , linux-kselftest@vger.kernel.org, Shuah Khan References: <20221001154908.49665-1-gnoack3000@gmail.com> <20221001154908.49665-3-gnoack3000@gmail.com> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= In-Reply-To: <20221001154908.49665-3-gnoack3000@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: Thanks for cleaning this. Can you please move this patch just before the test patches? On 01/10/2022 17:49, Günther Noack wrote: > The checkpatch tool started to flag __attribute__(__unused__), which > we previously used. The header where this is normally defined is not > currently compatible with selftests. > > This is the same approach as used in selftests/net/psock_lib.h. > > Signed-off-by: Günther Noack > --- > tools/testing/selftests/landlock/common.h | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/tools/testing/selftests/landlock/common.h b/tools/testing/selftests/landlock/common.h > index 7ba18eb23783..7d34592471db 100644 > --- a/tools/testing/selftests/landlock/common.h > +++ b/tools/testing/selftests/landlock/common.h > @@ -17,6 +17,10 @@ > > #include "../kselftest_harness.h" > > +#ifndef __maybe_unused > +#define __maybe_unused __attribute__((__unused__)) > +#endif > + > /* > * TEST_F_FORK() is useful when a test drop privileges but the corresponding > * FIXTURE_TEARDOWN() requires them (e.g. to remove files from a directory > @@ -140,14 +144,12 @@ static void _init_caps(struct __test_metadata *const _metadata, bool drop_all) > } > > /* We cannot put such helpers in a library because of kselftest_harness.h . */ > -__attribute__((__unused__)) static void > -disable_caps(struct __test_metadata *const _metadata) > +static void __maybe_unused disable_caps(struct __test_metadata *const _metadata) > { > _init_caps(_metadata, false); > } > > -__attribute__((__unused__)) static void > -drop_caps(struct __test_metadata *const _metadata) > +static void __maybe_unused drop_caps(struct __test_metadata *const _metadata) > { > _init_caps(_metadata, true); > } > @@ -176,14 +178,14 @@ static void _effective_cap(struct __test_metadata *const _metadata, > } > } > > -__attribute__((__unused__)) static void > -set_cap(struct __test_metadata *const _metadata, const cap_value_t caps) > +static void __maybe_unused set_cap(struct __test_metadata *const _metadata, > + const cap_value_t caps) > { > _effective_cap(_metadata, caps, CAP_SET); > } > > -__attribute__((__unused__)) static void > -clear_cap(struct __test_metadata *const _metadata, const cap_value_t caps) > +static void __maybe_unused clear_cap(struct __test_metadata *const _metadata, > + const cap_value_t caps) > { > _effective_cap(_metadata, caps, CAP_CLEAR); > }