Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp1255913rwb; Sat, 5 Aug 2023 10:22:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8BdPMBnh67TY8YdEtpZsbJLGYf1b9p2jUOkB23Zufhxho+YQxOrwEYEG4ANhhDEFcifll X-Received: by 2002:a17:902:ecc3:b0:1b6:6625:d3a8 with SMTP id a3-20020a170902ecc300b001b66625d3a8mr5688043plh.16.1691256122932; Sat, 05 Aug 2023 10:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691256122; cv=none; d=google.com; s=arc-20160816; b=i6e0TdI4ZggmBvftxHC5tT5r8okf2Qwh71CYq57ILlmY6RANPqr9AL8uPRsyAZu3E+ Czf0/XFwjSe+cIooWXh5nUCurRMCJ71Egke8Q77VPhRZUPFFGJWFKNJLJiSMFnHjwNYq zCbOfnHOZEbi0WyciCV/IOkJ6QHxeeEQQy6AAg/WcjeFMrWsPUu5HaY/TrfuqfakYMCJ Gh3u+S7rgZfUvQ4SW/iJlnoU9Q1DQOAV+zu0Q1MV3XwzQTaaCMBdLxK5LEQjqQ3c91c0 F6weCC5UwVtdNWJZagskEkxtfXQn/spAL+WkFZ222dCSqHN2EVlS9DXm8c1BOUWO0C9V iF5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hd+Ke1dOFJzwuqb7G5cfNR6h7qw+U8GvenaQY78KI3c=; fh=XLgxCw6kQWJd90UaW0QKkMGE292sSoLJai8ThDu4OTQ=; b=VRHOfCaoakgex/6JQ/PzW/qE+c++KjUT3XcFJ2Tclsu/mFDI3wzv+RqeBz6bXl9jgk kRSLRQeOz5wQJRTZA5p7gZaPtyLoKE/232s+a31bkSZkK1jwyXGTWObAxvrrPJx/r5wz flHwIGNFUC8C3LcMUm0JUevWqHEdvy3VBBpPgF29YrBdCMmlF3190A80JzFADqLQZ1vA tuuhdt1TLZgD0BVF8owE70zoZXdbzzpthhN1ZcZi92C166M13QSgQRCkIgiTVDTeuT/8 4kxeoZItx4z+MbrJmIOsHiTC+VgObzH0XTmJErG0YDiTpg8Vz6wuIuCxVkAIBlsuN7RO 99sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=RSf4+NaR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li5-20020a170903294500b001bb162e944dsi3376830plb.51.2023.08.05.10.21.50; Sat, 05 Aug 2023 10:22:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=RSf4+NaR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbjHEQZ7 (ORCPT + 99 others); Sat, 5 Aug 2023 12:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbjHEQZ6 (ORCPT ); Sat, 5 Aug 2023 12:25:58 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E19FE10F8; Sat, 5 Aug 2023 09:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691252753; bh=n+KIGDLXUCXqwwdfMNnhnPNoQs5vP1Mvjy/BSICI1ag=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RSf4+NaRQcnlzLmZF93FPWVNlfYzn2+aMXniJ2kae4/LSxYoDqXc09EiciDlRaEGg Li0WogOIDT47XM2FfNIPFZNir25kP2nmQYZEyCeqCqpPKd97qrzNF/g96nhD/0mxmN 2nMIHDy6X61+m65cNi2DjRTJgz7jsP3iVkKlwkVM= Date: Sat, 5 Aug 2023 18:25:52 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Willy Tarreau Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu Subject: Re: [PATCH v3 05/14] tools/nolibc: stdint: use int for size_t on 32bit Message-ID: <44f1bab4-9d0a-4e7d-a73b-2c00c6029070@t-8ch.de> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> <20230803-nolibc-warnings-v3-5-bcc1a096ae02@weissschuh.net> <20230805161929.GA15284@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230805161929.GA15284@1wt.eu> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-08-05 18:19:29+0200, Willy Tarreau wrote: > Hi Thomas, > > On Thu, Aug 03, 2023 at 09:28:49AM +0200, Thomas Weißschuh wrote: > > Otherwise both gcc and clang may generate warnings about type > > mismatches: > > > > sysroot/mips/include/string.h:12:14: warning: mismatch in argument 1 type of built-in function 'malloc'; expected 'unsigned int' [-Wbuiltin-declaration-mismatch] > > 12 | static void *malloc(size_t len); > > | ^~~~~~ > > > > Signed-off-by: Thomas Weißschuh > > --- > > tools/include/nolibc/stdint.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/tools/include/nolibc/stdint.h b/tools/include/nolibc/stdint.h > > index 4b282435a59a..0f390c3028d8 100644 > > --- a/tools/include/nolibc/stdint.h > > +++ b/tools/include/nolibc/stdint.h > > @@ -15,7 +15,11 @@ typedef unsigned int uint32_t; > > typedef signed int int32_t; > > typedef unsigned long long uint64_t; > > typedef signed long long int64_t; > > +#if __SIZE_WIDTH__ == 64 > > typedef unsigned long size_t; > > +#else > > +typedef unsigned int size_t; > > +#endif > > This one breaks gcc < 7 for me because __SIZE_WIDTH__ is not defined > there. However I could trace __SIZE_TYPE__ to be defined since at least > gcc-3.4 so instead we can do this, which will always match the type set > by the compiler (either "unsigned int" or "unsigned long int") : > > #ifdef __SIZE_TYPE__ > typedef __SIZE_TYPE__ size_t; > #else > typedef unsigned long size_t; > #endif Sounds good. But do we need the fallback? Further below we are also unconditionally using preprocessor-defines like __INT_MAX__ and __LONG_MAX__. So I guess we can drop the proposed #ifdef. > Please just let me know if you want me to modify your patch accordingly. > I'm still continuing the tests. Feel free to modify the patch. Thanks! Thomas