From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.formilux.org (mta1.formilux.org [51.159.59.229]) (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 3AACD270575 for ; Sat, 14 Mar 2026 04:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.159.59.229 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773463742; cv=none; b=PBuweWlhVIdGIyDjE6o+XWUis/EimiPzmjsFwL/llLj4e0GpBCsBQaljYg3cNRckbVrxMCNwuY7LhF8DxAVxGwgl0JH0c3ChI6qZog7MvLW8mX4Sd1LHC1Nwj23YRtmgytgeYBhrObTERUtvz20Vn0vN4H/b4M5WA8YCyLPr3nQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773463742; c=relaxed/simple; bh=qRgwIVJ9gvZYz0NyIKGNfKpKmf7sYe8n3GUBmQLQkTk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ErgoWQaYEQYx92WUDyFzzKyDps1O2IBkjJCLFA97izZmFD6Wk5zLaWm0VlXvILcK8YdXZI62GOzg3hpLrI+Lo1yiZYWOx0N4WU3hsHD9QbHE4JgJ+HiF7sZ5MOMSWXPp+zUgiNVzr25ilai25vxDL2YqNlo9UmvWNtHUDr6xhyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b=f7sBmev/; arc=none smtp.client-ip=51.159.59.229 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b="f7sBmev/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1wt.eu; s=mail; t=1773463731; bh=YNNyiGaduslXscXvxQw81PYHuMwIIsozyUQZi8BRluY=; h=From:Message-ID:From; b=f7sBmev/MUclJKdkJsbH14cRA+e9+QqySh+EIPeJmKcxCS+BlvmIkFu+/ecVPwukZ xhvO1yBPSCD6t/t6UlkbRu+MsBHTQvIYJCOq9dNh9mvsBkjExSxvRBtXfYQdOGN3LA GNQUqmMBgnFr6TWyUi+BBpCIkELW4zaQIed9SoNQ= Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by mta1.formilux.org (Postfix) with ESMTP id 8A1A9C0AC5; Sat, 14 Mar 2026 05:48:51 +0100 (CET) Date: Sat, 14 Mar 2026 05:48:51 +0100 From: Willy Tarreau To: David Laight Cc: Thomas =?iso-8859-1?Q?Wei=DFschuh?= , linux-kernel@vger.kernel.org, Cheng Li Subject: Re: [PATCH v5 next 00/17] Enhance printf() Message-ID: References: <20260308113742.12649-1-david.laight.linux@gmail.com> <20260308224121.56affbf7@pumpkin> <2590eeb2-bf4e-4c10-9a72-d1ed9cd25f88@t-8ch.de> <20260313224048.630424ed@pumpkin> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260313224048.630424ed@pumpkin> On Fri, Mar 13, 2026 at 10:40:48PM +0000, David Laight wrote: > On Fri, 13 Mar 2026 21:07:28 +0100 > Thomas Weißschuh wrote: > > > Hi David, > > > > On 2026-03-08 22:41:21+0000, David Laight wrote: > > > On Sun, 8 Mar 2026 22:01:19 +0100 > > > Thomas Weißschuh wrote: > > > > On 2026-03-08 11:37:25+0000, david.laight.linux@gmail.com wrote: > > > > > From: David Laight > > > > > David Laight (17): > > > > > tools/nolibc: Add _NOLIBC_OPTIMIZER_HIDE_VAR() to compiler.h > > > > > selftests/nolibc: Rename w to written in expect_vfprintf() > > > > > tools/nolibc: Implement strerror() in terms of strerror_r() > > > > > tools/nolibc: Rename the 'errnum' parameter to strerror() > > > > > tools/nolibc/printf: Output pad characters in 16 byte chunks > > > > > tools/nolibc/printf: Simplify __nolibc_printf() > > > > > tools/nolibc/printf: Use goto and reduce indentation > > > > > tools/nolibc/printf: Use bit-masks to hold requested flag, length and > > > > > conversion chars > > > > > tools/nolibc/printf: Add support for length modifiers tzqL and formats > > > > > iX > > > > > tools/nolibc/printf: Handle "%s" with the numeric formats > > > > > tools/nolibc/printf: Prepend sign to converted number > > > > > tools/nolibc/printf: Add support for conversion flags space and plus > > > > > tools/nolibc/printf: Special case 0 and add support for %#x > > > > > tools/nolibc/printf: Add support for left aligning fields > > > > > tools/nolibc/printf: Add support for zero padding and field precision > > > > > tools/nolibc/printf: Add support for octal output > > > > > > > > Beginning from here we have another sign-compare warning: > > > > > > > > /home/t-8ch/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-gcc -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra -fno-stack-protector -Wmissing-prototypes -fstack-protector-all -mstack-protector-guard=global -fsanitize=undefined -fsanitize-trap=all -m32 -Werror -Wl,--fatal-warnings -o nolibc-test \ > > > > -nostdlib -nostdinc -static -Isysroot/i386/include nolibc-test.c nolibc-test-linkage.c -lgcc > > > > In file included from sysroot/i386/include/nolibc.h:123, > > > > from sysroot/i386/include/stdio.h:8, > > > > from nolibc-test.c:12: > > > > sysroot/i386/include/stdio.h: In function '__nolibc_printf': > > > > sysroot/i386/include/stdio.h:569:41: error: comparison of integer expressions of different signedness: 'unsigned int' and 'char' [-Werror=sign-compare] > > > > 569 | if (sign_prefix != *out) { > > > > | ^~ > > > > cc1: all warnings being treated as errors > > > > > > > > I have applied all of the patches *before* > > > > "tools/nolibc/printf: Prepend sign to converted number", which > > > > introduced the sign_prefix variable. > > > > > > > > Could you fix this up and repost the remaining patches? > > > > > > I hate 'sign compare' ... > > > I dislike using casts to 'fix' it - random 'integer' casts have caused me > > > grief in the past. > > > I don't want to make 'sign_prefix' signed - stops you adding 4 characters > > > (should you so desire); not to mention >> being either UB or implementation > > > defined on signed values (or maybe just negative ones). > > > > Sorry for the long delay, I missed these mails. > > > > > > > > The two obvious fixes are: > > > if (sign_prefix - *out) > > > > I went with this and applied the rest of the series. > > Thanks for all your patches! > > Thanks - I hadn't got around to resending them. Thanks to both of you, I think it's a really nice improvement, and the final quality was worth the number of round trips. Willy