From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 A2F842E0904 for ; Wed, 21 Jan 2026 16:07:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769011640; cv=none; b=t7Bd/g2NLws/W0QAdMlo7/tixcaP1SADpk4A4QrgKTaNZHlHfYBaLvJQDsm/zeKzLqi8dfDuZHG1UOUgmq8alLog+W9JkRPoBgonxhOXn9m1EVX4fDCkwoFne60ultCNzEK/Q8v/JlMmQ8wHso2xLbgBwId6dNE6zBXAyN6dU+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769011640; c=relaxed/simple; bh=R8j2uJWCuPQF4jnyFmqkM+Jyum5uRWUwD37pUrqBtog=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YplSRpom7IkoLoZM7KpSnGM//cJysyakA5WObWAUfV427XKqtAsZIEZcT8c+cl78BIhuYdIx9Gig+tL6swMx3izReOvJ6gjEWe6viLqccXVtRTVgtGs8/kS+kXTEicE8iRoGlEWGBJT8dUyzBMCQdUZzKQDrNJf1bG6PoKTMDHA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=aNi+Xu7n; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="aNi+Xu7n" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-4327790c4e9so4153107f8f.2 for ; Wed, 21 Jan 2026 08:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1769011636; x=1769616436; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=wg40ewCl+D/97ANr1h+YLqT6oKOLJb+xdwWdPiyglqQ=; b=aNi+Xu7nm7t26OPqy7IZ4hpGs3xGc5astAJNsGcUep6wAe8IzcbkhD5DSAJAZF3dhx uvu7QsjAA1sEu0sbo8Z4DfMsYfCz+Id+lpuaNaIOzvVgFvsZPZUhCGDvDENwjjYQ5kHV mUMsaZIvBJrjs52tfHzMDqMyWE1Z8Mnqkf+lcFNAafHkYEZkKLxQdPcACufg+xfy6khW eMizEvnONql/WYgfmUEv4VZgyj7S1TpuiD0xuOaieTMtUpqSdJQuzHDmzA0HDpP3Mg34 Uf9j4JpCgEYBaa/xcwxOx9PYapv/4ITUGxI9wMGKYUuNkYmijMxOGqcN2hgHnmpC2lD7 Qi0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769011636; x=1769616436; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wg40ewCl+D/97ANr1h+YLqT6oKOLJb+xdwWdPiyglqQ=; b=PtLv8B9M8dz8zoTtfP8jgNSIw/nZmlx8zpH5+rLfD/asY/IbYf9fkJ5Kr3YCMqcBlc laeXZTZ9SWq7Imb4s5BAKfo8jTcGoojn4MEedc2q7aNAiEzGqsIzauixmN6HmdeV+RqF 9yDp5xamaiuDeii1oBD9/efCMuw6NsNRN8IYqc2tlSlkfcQOoJsFslSp2y5Zbfu6pqhr lsvKcZRaZWGirZHxaaAThh70gpg1zVhk5CMzoo70aSD3WEeSomsa54FhR4oef+mT229/ 6fVUN7Z6CX7A3+911mUm6KXKE/bzpM77eRem2rcEwNahdUr2+HAirV/SBu4IpagdGRuJ xh4w== X-Forwarded-Encrypted: i=1; AJvYcCVZD+UzY3zuglSFvnjSCk9OcdLupw9rLsEsEZKXj8x+SoN5r9xRgi5i3Rpp9gQdS96/VTHiSF3GjcHg+l8=@vger.kernel.org X-Gm-Message-State: AOJu0YxRRAKLe3psjkEHiQf/YNBDkg4p9HJUNj5us85GkoPmprMZ+cif dep8oQe+X/hMcfqcUvx19DaG4Gm55nIIVL3HyesLU5gLEZwz3NsAomBn9NuIgfYiMKo= X-Gm-Gg: AZuq6aIZVa5plzqmwthqahjuyIEVcf4LfrtRwh1lSN8OUIIprJddCpHiffiRsF/aLIJ RXi5EqjYPdmj4U3t5sUiyH+O/6zNKkjG6cJiI82BnQs1MS/warpoLBRX5oEfyK+DBNAKs7lz3C8 E0dZh9qocZVtM1fMp7rJIby6m7RVuPXD/VnZRIBtmNypuPMoOAG4TcV6RjjA6oHZOfKUzPZbuPP eyuRtjxg0cHYcq7+QlkbbsvcFSa7hXs4gJopihrUvUjrrerNmayPClO/CpORwKVKbTIC6D3m295 VXlyENNbBx7t/lN409+2zbsyuvZ4bjxDJiMV56jeCqnDNazTP0oV5Z/a4JIUc0DVEIJdRvHTuAy 7uCw+fTJHOQ6ISiQC2UZ8GHekhbj05bNE6UBubvCXn47qxYkCfzRhVZgAV9ULt9KGz2qdLivAE4 O7Jlw= X-Received: by 2002:a5d:5f94:0:b0:431:1d4:3a8a with SMTP id ffacd0b85a97d-43569972d22mr24018615f8f.7.1769011635930; Wed, 21 Jan 2026 08:07:15 -0800 (PST) Received: from pathway ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356992201csm38511033f8f.2.2026.01.21.08.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 08:07:15 -0800 (PST) Date: Wed, 21 Jan 2026 17:07:12 +0100 From: Petr Mladek To: Tamir Duberstein Cc: Andy Shevchenko , Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Kees Cook , linux-kernel@vger.kernel.org, oe-kbuild-all@lists.linux.dev, llvm@lists.linux.dev, kernel test robot Subject: Re: [PATCH v2] printf: convert test_hashed into macro Message-ID: References: <20260116-printf-kunit-printf-attr-v2-1-3dd7fefc3207@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue 2026-01-20 10:50:09, Tamir Duberstein wrote: > On Mon, Jan 19, 2026 at 3:21 AM Andy Shevchenko > wrote: > > > > On Fri, Jan 16, 2026 at 11:27:03AM -0500, Tamir Duberstein wrote: > > > This allows the compiler to check the arguments against the __printf > > > > __printf() since it takes parameters, OTOH it's an attribute at the end, > > so I have no strong opinion on how to spell it. > > > > > attribute on __test. This produces better diagnostics when incorrect > > > > __test() > > > > *This is reference to a function. > > > > > inputs are passed. > > > > ... > > > > > +/* > > > + * This is a macro so that the compiler can compare its arguments to the > > > + * __printf attribute on __test. This cannot be a function with a __printf > > > + * attribute because GCC requires __printf functions to be variadic. > > > > As per commit message remarks. > > > > > + */ > > > +#define test_hashed(kunittest, fmt, p) \ > > > + do { \ > > > + char buf[PLAIN_BUF_SIZE]; \ > > > + plain_hash_to_buffer(kunittest, p, buf, PLAIN_BUF_SIZE); \ > > > + test(buf, fmt, p); \ > > > + } while (0) > > > > Make sure you used tabs to indent the \:s. > > > > ... > > > > The downside of a macro is a killing of compile-time type checks. > > This macro still bottoms out in __test() which is a function, so I > believe it preserves (and enhances, per the commit message) > compile-time checks. > > I'll send v3 with the changes you requested above. JFYI, I am fine with this approach. Best Regards, Petr