From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f73.google.com (mail-oo1-f73.google.com [209.85.161.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2736624501D for ; Mon, 6 Jul 2026 18:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783362726; cv=none; b=c0SECwN8Ds3BBWdScNujoWiv8/3zwzLQuBABkauJpam+wUZgzI54H5phL7RQMSk4pcUyySy9/n9TXsrlapmBgFcEFY2kqAeFoxHwTP05N2VQ7NcjPIUP9xtRGXLcJHA8h8L5sQuQAZnxF0Lm+V7yseakM36UF1GdCJze1tjO6Uw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783362726; c=relaxed/simple; bh=LQpZuqWDhGaY8Lp7XP00kP+hrd4jA3kaR16Fcs8BB8Q=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=kuWA/fAXt8G/so5/O0Aek1e99Z3T8eSB110X82fzg6g7o9ssv7HOm14NX6BTmi0vkQoQA9OeHjTXrJRB3f/rnbtCxiOfJAqteQ3EBP/YsW7NLEZuG/K395j5j6ZyUPhw0RLZcwPPW4iMnoL6Zo7G1DVqacMU3Bcv/T/K2prAPZo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=QVq5o7Y4; arc=none smtp.client-ip=209.85.161.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="QVq5o7Y4" Received: by mail-oo1-f73.google.com with SMTP id 006d021491bc7-6a18bd9c3caso4233256eaf.1 for ; Mon, 06 Jul 2026 11:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783362723; x=1783967523; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zaPUDS5X61bEGf4R9DTCwdGD0nVsXP4UZeidWRH5cHA=; b=QVq5o7Y48Ru54zSfT+B4E0yKG642nFs3X69RmJ1iPe5YVfrAOxP+Bd5XPHXhvvJfi9 M6e+PSdkTiRKPI7NgDNsUTbJ4Xhw6HcVqL2eN/+slFI2D5eaxBQ2pzMb5uHNEk6zAtFS tpAv3QcnQAzPRVtTGV9lt1mEsLmn2j0h4W7YSUW02PnMmUl26Qh3qKb/+6kqnee6rHQf Lz6LiboekASWT44cAxNcXoo3xRJLq8B75k1aBGnjyxcNEo9CQqR//1VYUxFwiJylhSaB xeR2f7NkITgn95Be0cKFlqlOGIl6BHigdbG2g9PS0QlmVH5nwoY9+bD1LF4CI31m9Xlh /siQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783362723; x=1783967523; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=zaPUDS5X61bEGf4R9DTCwdGD0nVsXP4UZeidWRH5cHA=; b=q/gtXg6PH7vmuZ3MceZ55yRAKjjcQWJIpBR/4aIeP3g29vb7ihIyI8TELeM6Q496Mv EJKqRfmemkvc/soMfAUYktHCQCa3kiqJOcQz2F+pf68EZ0cKPZWzu4X4/KktmU/M9/B/ z4ue9PSbyAxH1tCYho0DPizR9A9wsZz37uKElkB2ApsC7j7iaj/zrKTnMNGyd2DifPem lx4GI1T+jLMVJb1bTyN0hbpGxkRVZnxFABuGF55j3s4SLSuwdg+ObMRS2G8n2qTfQJmJ 8L/5ePaEq2c5IQn6YOT6qS0j2uRJZwBa8A0NnswYKmDtQxi0SGE0xTitlK86noFEaRqx j2Fg== X-Gm-Message-State: AOJu0YzxlyXc5o/rp9mSGtyH0Be8/WAoQ86XS9MvF2eIE9UjMxPgb1B6 73cCSJlx68Y7FdRoWhqUNqU8wRjSa1Gt2vrUrw7BOfdEePaE4Y2rtSZwnmy/Dy7YnOrWq8w3Rbh C1MXpEv7NaP2zhMdnAfgb+St7ZdXiF5qtVl+okrwnuevk1adcyEqT4DL71cLlWONFULImw3ewjc 3mMsumRoG/OM/Fm5cMC0i4ucwWdHqr3NZOX5buKQIU1FWEBcXKBQKeEgI= X-Received: from oacg2.prod.google.com ([2002:a05:6870:d202:b0:448:c6c8:879e]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6820:4b02:b0:6a1:50eb:d519 with SMTP id 006d021491bc7-6a3556d62a2mr1000185eaf.58.1783362722788; Mon, 06 Jul 2026 11:32:02 -0700 (PDT) Date: Mon, 6 Jul 2026 18:31:54 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.rc2.803.g1fd1e6609c-goog Message-ID: <20260706183154.2660394-1-dmatlack@google.com> Subject: [PATCH v3] selftests: harness: Mark test fixture objects __maybe_unused From: David Matlack To: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev Cc: Andy Lutomirski , Bill Wendling , Justin Stitt , Kees Cook , "=?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?=" , Nathan Chancellor , Nick Desaulniers , Shuah Khan , Will Drewry , David Matlack , Kuniyuki Iwashima , Aaron Lewis , Alex Williamson Content-Type: text/plain; charset="UTF-8" Mark _##fixture_name##_##test_name##_object __maybe_unused since it may not ever be read. This pointer is only read in XFAIL_ADD(), which tests are not required to use. clang made a change to -Wunused-but-set-variable (split out into its own subwarning, -Wunused-but-set-global) that causes this warning to be emitted for various selftests and can be upgraded to an error in selftest that set -Werror. VFIO selftests have been broken since commit ff556bd98348 ("vfio: selftests: Add -Wall and -Werror to the Makefile"), and the net selftests builds have been noisy due to -Wall. Fixes: 24cf65a62266 ("selftests/harness: Share _metadata between forked processes") Reported-by: Kuniyuki Iwashima Reported-by: Aaron Lewis Reviewed-by: Alex Williamson Reviewed-by: Kuniyuki Iwashima Signed-off-by: David Matlack --- v3: - Pick up Kuniyuki's Reviewed-by tag. - Pick up Alex's Reviewed-by tag from v1. - Fix commit description accuracy (Kuniyuki) v2: https://lore.kernel.org/linux-kselftest/20260706175228.2468730-1-dmatlack@google.com/ v1: https://lore.kernel.org/linux-kselftest/20260630213341.1664345-1-dmatlack@google.com/ Note: The fixes tag is commit 24cf65a62266 ("selftests/harness: Share _metadata between forked processes"), which refactored TEST_F to share test metadata across processes using mmap and convereted the test fixture object from a static struct to a static pointer. Prior to commit 24cf65a62266 the static struct was always used once (the address of it was taken and passed to __register_test()), but after the static pointer was always assigned but potentially never read. Cc: Nathan Chancellor tools/testing/selftests/kselftest_harness.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index 261e4df94d9d..29a19bc87084 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -467,7 +467,7 @@ static inline void __kselftest_memset_safe(void *s, int c, size_t n) !__atomic_test_and_set(_metadata->no_teardown, __ATOMIC_RELAXED)) \ fixture_name##_teardown(_metadata, self, variant); \ } \ - static struct __test_metadata *_##fixture_name##_##test_name##_object; \ + static struct __test_metadata *_##fixture_name##_##test_name##_object __maybe_unused; \ static void __attribute__((constructor(KSELFTEST_PRIO_TEST))) \ _register_##fixture_name##_##test_name(void) \ { \ base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482 -- 2.55.0.rc2.803.g1fd1e6609c-goog