From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1C90ECAA25 for ; Thu, 25 Aug 2022 16:51:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243447AbiHYQvr (ORCPT ); Thu, 25 Aug 2022 12:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243856AbiHYQvF (ORCPT ); Thu, 25 Aug 2022 12:51:05 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A9DBB93B for ; Thu, 25 Aug 2022 09:49:37 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id d23so24657659lfl.13 for ; Thu, 25 Aug 2022 09:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=Zej4CxY/1CWynJQcpIFCE/ePm/cZkXwlSREUqfzuJ8Y=; b=h5BQlI0xIEyNRWKjxWMt8RcIcaw6Iab9Lro//TN7cNvmYLCYmjHA9b7vqil1aO5lR2 jjncnbXB0E5n8vUT5r/OBW2cdzESp8HNiF0+6Am4i8gbPE/IF29BiN++mET+t+9HhGXy KU+7dVHbSPecBR62YILXw08KL2z9er7opHtdU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=Zej4CxY/1CWynJQcpIFCE/ePm/cZkXwlSREUqfzuJ8Y=; b=mglY1DN7T1xJcc4a++eQSdEIgKr18V19+yDK88OfgingfLNZiqoLpYMHXdxFfvkSiD NY9pIBbgTgiEb/fNNWm+6BICVQyC1YFa83hGwJT6v/jfJ+EYEXnq17Ieqb9/W3cFFeLZ UID/M6EOQiGduuPn+xfJco7oixHMILtS8fSxONmv6TyEu+kQhn5QLLd1prs7xRk+IDwG oeHg7aHkvZplvLERVgb+sXMLf8qEqFyd4i0BD2VekhTSItdKCx/fJfIVEVBEx2TDmwAN la2eR5sX+v8GgGOw3dysq5pWJEZazl/fl8NGrptUG+1DtkvfaEtR05JoeVi/q3avfCt8 KYXQ== X-Gm-Message-State: ACgBeo1ZmQFj3FGgH5bK9ZqmCHfOPbSdVzNZqKRii6254tGJnrg32D5V hqxyuuRfPMP+bl99FCxu8FEsvEg1XtR0tdhJn4s= X-Google-Smtp-Source: AA6agR5bDX6jdlVo9rrOd8LBH2wmkHo7uVYn7bURv3UtfPdafi5WDNneuB9QDubDK6i76yHLiY7SsQ== X-Received: by 2002:a05:6512:2314:b0:492:b612:5390 with SMTP id o20-20020a056512231400b00492b6125390mr1582741lfu.115.1661446175821; Thu, 25 Aug 2022 09:49:35 -0700 (PDT) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id 124-20020a2e0982000000b0025e4e7c016dsm672186ljj.16.2022.08.25.09.49.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Aug 2022 09:49:35 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id l8so11495145lfc.12 for ; Thu, 25 Aug 2022 09:49:35 -0700 (PDT) X-Received: by 2002:a05:6000:1888:b0:222:ca41:dc26 with SMTP id a8-20020a056000188800b00222ca41dc26mr2680808wri.442.1661445807749; Thu, 25 Aug 2022 09:43:27 -0700 (PDT) MIME-Version: 1.0 References: <20210423230609.13519-1-alx.manpages@gmail.com> <20220824185505.56382-1-alx.manpages@gmail.com> <87ilmgddui.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Linus Torvalds Date: Thu, 25 Aug 2022 09:43:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] Many pages: Document fixed-width types with ISO C naming To: Joseph Myers Cc: Florian Weimer , Greg Kroah-Hartman , Alejandro Colomar , Alexei Starovoitov , Alex Colomar , Alexei Starovoitov , linux-man , Daniel Borkmann , Zack Weinberg , LKML , glibc , GCC , bpf , LTP List , Linux API , linux-arch , David Laight , Cyril Hrubis , David Howells , Arnd Bergmann , Rich Felker , Adhemerval Zanella , Michael Kerrisk Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 25, 2022 at 7:38 AM Joseph Myers wrote: > > I've not yet implemented it for glibc or for GCC format checking, but C23 > adds 'wN' format length modifiers so you will be able to e.g. use "%w64d" > with printf to print an int64_t and won't need those PRI macros any more. Yeah, that's going to help user space. We don't typically have huge issues with it (any more) in the kernel exactly because we refused to do the syntactically horrendous PRIxyz thing. So in the kernel, we still do have some format string issues, but they tend to be about "different architectures and configurations do different things for this type", and those different things are sadly not necessarily about a fixed width. IOW, we used to have horrors like "sector_t can be 32-bit or 64-bit depending on config options" (because small machines didn't want the overhead of having to pass 64-bit things around - from back when 32-bit was a primary target). We got rid of *that* thing a few years ago because it just wasn't worth supporting any more, but some similar issues remain. So we still have a number of cases of "if you really need to print this out, you need to use '%llui' and cast the value to 'unsigned long long'". But it's happily not as common as it used to be. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 761EFECAA24 for ; Thu, 25 Aug 2022 16:43:43 +0000 (UTC) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B9F013CA48F for ; Thu, 25 Aug 2022 18:43:41 +0200 (CEST) Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 9D29D3C0134 for ; Thu, 25 Aug 2022 18:43:31 +0200 (CEST) Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 113221000411 for ; Thu, 25 Aug 2022 18:43:31 +0200 (CEST) Received: by mail-ej1-x62f.google.com with SMTP id h22so30414736ejk.4 for ; Thu, 25 Aug 2022 09:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=Zej4CxY/1CWynJQcpIFCE/ePm/cZkXwlSREUqfzuJ8Y=; b=h5BQlI0xIEyNRWKjxWMt8RcIcaw6Iab9Lro//TN7cNvmYLCYmjHA9b7vqil1aO5lR2 jjncnbXB0E5n8vUT5r/OBW2cdzESp8HNiF0+6Am4i8gbPE/IF29BiN++mET+t+9HhGXy KU+7dVHbSPecBR62YILXw08KL2z9er7opHtdU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=Zej4CxY/1CWynJQcpIFCE/ePm/cZkXwlSREUqfzuJ8Y=; b=HyuYV+vz2qF5G4UJMxKRc+agb49tb/eZzdSxGMy8s30ut9ojp+IBh+R4tqMTjS0YB7 s32AkCth0THUmi5h0W+7oiYwPfIJyOG6uidW48VHl5B430tDzTpaDYNbu4VRBq+GO3zE PIV3jrPKg0twK6jjuh/rxtowX+zEBE/MwHRRJ1BFs2T9ukrfwCflIgXdNsOo8AqU77iB CSLjVWKTHmql1hSJWnr3Q2nu7eSkw0fVLlf43Bx6EppfP3CWVxbzSe+hzja5Yjec4pDT jfsACT7A2MGn5NDxRX0uFOIwAYUp09WMUQlUpAiLEnRUDJjQNRejsxFpQP4Tuvnz62to LPoA== X-Gm-Message-State: ACgBeo0IVUT316sTvxCV/9fGaOsenRB+fsYK1L0QBMm5OdkRYTrqSf+M umlpbj6kZHb78eSEtVWBg5bH7dCTMM56PP6JFVk= X-Google-Smtp-Source: AA6agR5Ltp6P8MtPvso0KrCcWyb/BDLyffL3bamM5R/PBbsiY6i5ti39shF7qDYULk//FiSXe22hMQ== X-Received: by 2002:a17:907:c0e:b0:731:614:e507 with SMTP id ga14-20020a1709070c0e00b007310614e507mr3072571ejc.529.1661445810134; Thu, 25 Aug 2022 09:43:30 -0700 (PDT) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com. [209.85.221.47]) by smtp.gmail.com with ESMTPSA id d7-20020aa7d687000000b0044786c2c5c1sm2872318edr.3.2022.08.25.09.43.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Aug 2022 09:43:28 -0700 (PDT) Received: by mail-wr1-f47.google.com with SMTP id a4so25386631wrq.1 for ; Thu, 25 Aug 2022 09:43:28 -0700 (PDT) X-Received: by 2002:a05:6000:1888:b0:222:ca41:dc26 with SMTP id a8-20020a056000188800b00222ca41dc26mr2680808wri.442.1661445807749; Thu, 25 Aug 2022 09:43:27 -0700 (PDT) MIME-Version: 1.0 References: <20210423230609.13519-1-alx.manpages@gmail.com> <20220824185505.56382-1-alx.manpages@gmail.com> <87ilmgddui.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Linus Torvalds Date: Thu, 25 Aug 2022 09:43:11 -0700 X-Gmail-Original-Message-ID: Message-ID: To: Joseph Myers X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: Re: [LTP] [PATCH v3] Many pages: Document fixed-width types with ISO C naming X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alejandro Colomar , linux-man , Rich Felker , Alexei Starovoitov , David Howells , Alexei Starovoitov , linux-arch , Zack Weinberg , Daniel Borkmann , Alex Colomar , Michael Kerrisk , Arnd Bergmann , GCC , LTP List , glibc , Greg Kroah-Hartman , LKML , David Laight , Adhemerval Zanella , Linux API , bpf Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-bounces+ltp=archiver.kernel.org@lists.linux.it Sender: "ltp" On Thu, Aug 25, 2022 at 7:38 AM Joseph Myers wrote: > > I've not yet implemented it for glibc or for GCC format checking, but C23 > adds 'wN' format length modifiers so you will be able to e.g. use "%w64d" > with printf to print an int64_t and won't need those PRI macros any more. Yeah, that's going to help user space. We don't typically have huge issues with it (any more) in the kernel exactly because we refused to do the syntactically horrendous PRIxyz thing. So in the kernel, we still do have some format string issues, but they tend to be about "different architectures and configurations do different things for this type", and those different things are sadly not necessarily about a fixed width. IOW, we used to have horrors like "sector_t can be 32-bit or 64-bit depending on config options" (because small machines didn't want the overhead of having to pass 64-bit things around - from back when 32-bit was a primary target). We got rid of *that* thing a few years ago because it just wasn't worth supporting any more, but some similar issues remain. So we still have a number of cases of "if you really need to print this out, you need to use '%llui' and cast the value to 'unsigned long long'". But it's happily not as common as it used to be. Linus -- Mailing list info: https://lists.linux.it/listinfo/ltp