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 EA0CC2737F8 for ; Sun, 8 Mar 2026 22:41:24 +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=1773009686; cv=none; b=V87ZG3w8WOY5IpwhMVQ0DeX/B8+Mq7vTUywUYs/enUJNEqwxXhdUpodbZx4AJiF7P4/4WotrXgbdfXZDlAX6Xo+xnKCXS5K4LbHis+lya83p18I+azrmQbrI0/NO/4tCKV9oL+ICI/N507IEz32ZfW8/a97WIDxflGC/htAvyo4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773009686; c=relaxed/simple; bh=+j0itG/Fn8eXr7RmzL4xHNZkS4rVnBP+9kyf0ijxFus=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ACdN3kwWQn60PGfSJH/Fl5KqC/BcsWQthveKAD7tS1NZSa7BLid+u+Jb27FvRwYLoCDAl6LdKlsMA094iyfIMoLCPyjS27d7dHqt4jAA7korIm+KWJf0SDhCgZ12zr51tupG3E7QUsTi6FbaAZ4Dk6Smfob0WQdIgA507zEwVOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X4myvuo+; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X4myvuo+" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-439b7c2788dso5370092f8f.1 for ; Sun, 08 Mar 2026 15:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773009683; x=1773614483; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=DgQo6QGI29WDmlv8AtNwmaekBMAB2UqrBjoJ10BZcJ0=; b=X4myvuo+3omJIvqaHAwQayABQqiy7Ofnj40oY6eP/LcPOZ2DLnKdeFgU8DPGZDo1ZB SNdF+84BstO8V86c5zOH/UUCKZroe0jlLMlA8kb+Epae5Tg4XXj90U00r0OVBvVM6JWo xr1lJgjjSlI4qJ0ZqfkdLk1IvzkHKZQVI4mAscxYk/iqmWJAy75h3z7N4Xrxx2vUrlSH wGUpUvfYHzIFjlMyguJjMWXqg896l3R2ax9t10YXXbmHgoINot4Hyrr8RgkP2SmgM4Ux vS2C19Bf/WYc/uQFHNi3AUy/Ba5xZ0nNvc0UFPe0BXLX+jKoZtcx3CMUZV3iaoehMOZd cpuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773009683; x=1773614483; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=DgQo6QGI29WDmlv8AtNwmaekBMAB2UqrBjoJ10BZcJ0=; b=uIchiZogdRM5a9e40Rlz4OAR1l9OrJf6v2BwIIwdHVI7muC/bhkxb9Acpexpr/qYtZ 4YBI8j94YtLeF8wRe/CqLes3Xuff3FqRsfIZArVOJ91zUelhqdTqJVLrLEDLB7yXt721 8qlSBUIWc8qPbrLX3e/dGWXfMQwhPlTN501GKlxnjf7E8pf2t0TZCWmyaWcgiQB/ca3q 4/kHTCwMmP3ze+IKuF/mZy1rJ0a5JtDpTb+4+wGRG5DOwE9E4Y4aCc3MGhmaqpM5zeNo trIzJTbtW1WWVaZv83hKMwZSXuxANokrtpdxlYl6l6YibqRiqW3JVjUtshrdCJxuijmE 6eaQ== X-Forwarded-Encrypted: i=1; AJvYcCXSsSwcNf+gzpc6Y0lAUcrWMBS9nlpD8C7C12h9aghOFPBWm/B02B2OmucRcOoHQS6UAc70UG2gptekao0=@vger.kernel.org X-Gm-Message-State: AOJu0YzJUgtCaurUrHU1Zlo5xr580SjXwvu1RhUUMTpi0fnC2kuVh0FV 2gnaw+oyxCzcpTotiTPfgK8EyG3TiMDWYhrbs5sHUh3UC9A7E+/8+c7g X-Gm-Gg: ATEYQzwJG0BWICIB9LTYjcmqCWMlR0QjsEaTvggHbfDFG+raUinIsjZS5TOyw2tsErk ghsb7ccNWgK1OU0VXOiehqHI/ySPRiPvw/Wywg7o0KQLOAtTxhmefeAQR7hABqdMX+cgsyNprlk yKphzzJ5hu4vSGquvYcOnnMiy4xWPd0YnBmZxjaZT8gI+fLi9QT8myS7HGdBQXijXKIXNI6TWn0 D62W4o3uW7P39TTg0iKrEdfhMcxWFsHbLXnubE9dp/FtbkRDt11PmUJi07s3FL3tyl4nyXNEg++ NzcDhEfNYI7Gnrxtlw2Zvf+5tyKJZcg9YuIyLjQt8vl6mhFl7WTpLAB6tzaCXVnkquxSznTS2Kw OyiA3cPoEOhq4tqIm8Ftufa2t7yTddE/hK/Uw23Ub6ehbOiAkqJ1+mr1nh5+CIf8tkGyg+19Hqr NsVAJN1A4cfSmHOhNFJ/iFLm5VNZsotYV0vId3FvbqOySAC3vZOOuENvi/8S2MHvIZ X-Received: by 2002:a05:600c:350e:b0:477:7b16:5f9f with SMTP id 5b1f17b1804b1-4852697860dmr160538975e9.31.1773009682968; Sun, 08 Mar 2026 15:41:22 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4853c784813sm12029565e9.5.2026.03.08.15.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 15:41:22 -0700 (PDT) Date: Sun, 8 Mar 2026 22:41:21 +0000 From: David Laight To: Thomas =?UTF-8?B?V2Vpw59zY2h1aA==?= Cc: Willy Tarreau , linux-kernel@vger.kernel.org, Cheng Li Subject: Re: [PATCH v5 next 00/17] Enhance printf() Message-ID: <20260308224121.56affbf7@pumpkin> In-Reply-To: References: <20260308113742.12649-1-david.laight.linux@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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-Transfer-Encoding: quoted-printable On Sun, 8 Mar 2026 22:01:19 +0100 Thomas Wei=C3=9Fschuh wrote: > Hi David, >=20 > thanks again for your patches! >=20 > 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 =20 >=20 > Beginning from here we have another sign-compare warning: >=20 > /home/t-8ch/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux= -gcc -Os -fno-ident -fno-asynchronous-unwind-tables -std=3Dc89 -W -Wall -We= xtra -fno-stack-protector -Wmissing-prototypes -fstack-protector-all -msta= ck-protector-guard=3Dglobal -fsanitize=3Dundefined -fsanitize-trap=3Dall -m= 32 -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 express= ions of different signedness: 'unsigned int' and 'char' [-Werror=3Dsign-com= pare] > 569 | if (sign_prefix !=3D *out) { > | ^~ > cc1: all warnings being treated as errors >=20 > I have applied all of the patches *before* > "tools/nolibc/printf: Prepend sign to converted number", which > introduced the sign_prefix variable. >=20 > 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). The two obvious fixes are: if (sign_prefix - *out) or: if (sign_prefix !=3D *out + 0u)=20 Your pick :-) At least it is only the last couple of patches. David >=20 >=20 > Thomas >=20 > > selftests/nolibc: Use printf variable field widths and precisions > >=20 > > tools/include/nolibc/compiler.h | 3 + > > tools/include/nolibc/stdio.h | 427 ++++++++++++++----- > > tools/testing/selftests/nolibc/nolibc-test.c | 99 +++-- > > 3 files changed, 371 insertions(+), 158 deletions(-) =20