From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D397F34F46D; Tue, 2 Jun 2026 20:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.159 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780432369; cv=none; b=prqi5L0R36504WW9Xe1E88A8tTkQlLHUkG0tJ87vyZ6qi5Tk3Kvruc+/3ST4Zpn4GP/GgedsyNFhISAWhSCHxO0r7o2/hHzVOi+LC0Ana89XUjnibBu9LKoj8zf6KXo4ThxeGW+BwXKob91oD3DTNmZRQozp1+/5p9YI0jyEEoM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780432369; c=relaxed/simple; bh=P0QnsQoLM1byQG+q9EIQ+vv+d1oecWA4HDzYJ87Pet0=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=hDeJHOkuAuomB4GFd8eWyCK2nl/HeiA9DykmFM+l9nKIGnVNGCHSNYa8nWAxK2JsN8AJEFUXlNXuUJ5BkGKJHOrJ6O39IbcZEfR3QTq+jJzdO5PT0hU2NFtPNCwExMD7OTFuKHVVBlm0X+DQ+vLpKabTDG4I9tgeaUXXNXhf60M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=EaAWwa7i; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hPaaIjzP; arc=none smtp.client-ip=202.12.124.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="EaAWwa7i"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hPaaIjzP" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 483087A00D5; Tue, 2 Jun 2026 16:32:46 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-04.internal (MEProxy); Tue, 02 Jun 2026 16:32:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1780432365; x=1780518765; bh=4UlQlg6gKVDMsOvjIMppFn4eB9CwfNHEg4isd2yLNAo=; b= EaAWwa7ik8uVsjTW/TPS/vlliARiqvx4v70djSPDhd1pOVysfvVt75qSUIjkQEOK t+MmYz1LHITxN+nR1Ca0fpgBvB/C3tgXWrymoaURNTIATf83c1aKCYpJFopU8i83 v7ev7sWWcLExMaXKqHB0bkL+FpzmKVBdI8u7lWnk7krvrbDhwvMHUVhcT4i+xN8Y E2SWiu8KqBgAv15jv9e6g8cgGk7xLe8eEqnk0aoDKx2MTL5yPxnFvCzJgAIK7nEd hIDPL6eNervpJOQ7TJQEbeYdA+dsLpeK+sV96EfRXTrFn7uCFWrTP/wwB19jhU+s sSQV72TCubcYO1nK2cyv8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1780432365; x= 1780518765;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nzNWQSpW+qJDQdJ5CUDKfAQlnu+rn1WQ99AAQ5x1I1WnptWOg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 2542F182007E; Tue, 2 Jun 2026 16:32:45 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ThreadId: AAuCPBQLA6as Date: Tue, 02 Jun 2026 22:32:04 +0200 From: "Arnd Bergmann" To: "Andy Shevchenko" , "Arnd Bergmann" Cc: "Steven Rostedt" , "Masami Hiramatsu" , "Andrew Morton" , "Petr Mladek" , "Nathan Chancellor" , "Dennis Dalessandro" , "Jason Gunthorpe" , "Leon Romanovsky" , "Arend van Spriel" , "Miri Korenblit" , "Mathieu Desnoyers" , "Rasmus Villemoes" , "Sergey Senozhatsky" , "Nick Desaulniers" , "Bill Wendling" , "Justin Stitt" , "Vlastimil Babka (SUSE)" , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, linux-trace-kernel@vger.kernel.org, llvm@lists.linux.dev Message-Id: <35c1ba62-e74d-4abc-aa73-ccd35968ff89@app.fastmail.com> In-Reply-To: References: <20260602150904.2258624-1-arnd@kernel.org> Subject: Re: [PATCH 1/2] tracing: work around -Wmissing-format-attribute warning Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, Jun 2, 2026, at 20:59, Andy Shevchenko wrote: > On Tue, Jun 02, 2026 at 05:07:05PM +0200, Arnd Bergmann wrote: >> >> A number of tracing headers turn off -Wsuggest-attribute=format for >> gcc, but they don't turn it off for clang, so the same warning still >> happens on new versions of clang that support the format attribute. >> >> To avoid duplicating the same thing in each tracing header, as well >> as changing all of them to also turn it off for clang, add a new >> __vsnprintf() helper that is not annotated this way in linux/sprintf.h >> but is defined to work the same way as the regular vsprintf. > > vsprintf() Fixed now > Why the __printf() annotation is in the C file and not here? > Is this all about headers as the second paragraph in the commit message > explains? > I would add a comment to explain it here, otherwise we might see false > patches to "make things consistent" in a wrong way. I've tried to come up with a kerneldoc comment now, similar to the one for the vsnprintf() function, and added a separate prototype in the header. Does this address your concern? Arnd diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 3caf0796f54d..7c696aea2ed3 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2975,7 +2975,23 @@ int vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args) } EXPORT_SYMBOL(vsnprintf); -int __printf(3, 0) __vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args) +/** + * __vsnprintf - vsnprintf() wrapper without __printf() attribute + * @buf: The buffer to place the result into + * @size: The size of the buffer, including the trailing null space + * @fmt_str: The format string to use + * @args: Arguments for the format string + * + * This has the exact same behavior as vsnprintf() but can be used in call + * sites that are missing a __printf() annotation, e.g. because they + * get a 'va_format' argument instead of format and varargs. + * + * For this to work, the attribute is added to the declaration here but + * not in the header. + */ +int __printf(3, 0) __vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args); + +int __vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args) { return vsnprintf(buf, size, fmt_str, args); }