From patchwork Sat Jun 3 08:05:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 102794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1539728vqr; Sat, 3 Jun 2023 01:46:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40EYP6GkCg2ZVhZkZQTQNL7GvbSH0BT7aXL7TaBoO9ckDsPsJ3bTNe6EG/uNTcWxeCHkk8 X-Received: by 2002:a25:4056:0:b0:ba7:3df3:6df5 with SMTP id n83-20020a254056000000b00ba73df36df5mr6701651yba.38.1685781964916; Sat, 03 Jun 2023 01:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685781964; cv=none; d=google.com; s=arc-20160816; b=dUihJB+/BbKyifrTyWTyle9sRQRtCXiDj5qEGEICmGQuJIvoT6MjeOrT39q/wrUV1x vcnPHhCKymzIWy0IUJBxPqtQ+0twBpJWA5NAIbafIwBFZeIor6mCqHHrCajRAqzAIHfs P3TmTadsYTZDmbvu7/Ta9REBDBE4397Ojt5IDDoCAFXm4sXzEM8t1U5+lN2SZyOUdz8F vfklGK5TkFnGLv/jjkPlgUIGEaXGW008cIBXfEHpIakpPMmZkE6lPHrj1rC6MaIP4Yvu vHoZEF8ume9SSxZAIKIZ721grJlR2VRur4BTcqAB/QCqu3MaVUCYE1oLDDviAxH7hY+X OdpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=LEHM89t6TiDYScbQtAXo9zGQ/lAkUDwksG4zUmdWi4c=; b=gVDisN/lzGcvHzCUkXGO7ngPIp3TSYmfkKYMLeku/jC3LgWRvWHxtbOpb20IENwvCQ GcSK8Rx5/mWPUQ8SWiwYRAWGaYtABm5jCBJ8iw7P/kN5SZqJt7yroluG4RN3ScnWDPB0 oGOr4YyltwebJf/HgjpCwpPBCFqyPNKoT2vfg02ROAEqBD2FgiP/oC7R6yqPk+nMt0GB aT9qnhJjPyichJCmM95R+PXp1XI7d4X73KBXzGdQ6tLpZxH6PWGh+VtameEU5iZZ6BOJ TNEzdGheqsJK6TF8CcGBYA4vf+qK5upzcI7AjErmLRn266AYNKD80DQq7KEdd0xDpEkt tPiw== ARC-Authentication-Results: i=1; mx.google.com; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o64-20020a17090a0a4600b002533ea2ad58si4170169pjo.140.2023.06.03.01.45.49; Sat, 03 Jun 2023 01:46:04 -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; 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 S232282AbjFCIGB (ORCPT + 99 others); Sat, 3 Jun 2023 04:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjFCIGA (ORCPT ); Sat, 3 Jun 2023 04:06:00 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C5CCE40; Sat, 3 Jun 2023 01:05:58 -0700 (PDT) X-QQ-mid: bizesmtp73t1685779549t2ig12j6 Received: from linux-lab-host.localdomain ( [119.123.130.226]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 03 Jun 2023 16:05:48 +0800 (CST) X-QQ-SSF: 00200000000000D0V000000A0000000 X-QQ-FEAT: 5CNn+SP0K2tsOionl/0qwFkto2mrob0OpN+vWURE2tYM65THhHtj71FAAGwF9 OHfpVFQZWFWNg003NYWU3Fed3VjmEgjfH0VEiKfzoCC9x1lPpUpqjuPCBEQ9cwGb+kNx2uz 8ODZZl0Vg7kpMG+4idFATFRnoD6xllszwiioL1IQZq3pJIjiEteOcwnQLkmLihMC8Ytr2ZQ Lzn60B7Gv+NrtWbnPlaedDpvBa9WjGx9avOWjpeM4bMz/256y4uPHB5E9Tjok94D2WBYBTC m4Be7XkPDi4Pup0R0s5A8AHaU8EkG6y+r9ZCTgb1kOD8bMbb0O+VVSUGpm7Dd+oVBHZP4VM 1TIfWKoEdDYVJ4W7R2/hnRWOyFGos/MH4eqN9UbQfL2A6wCucm5MFDIzLdPDYAvtQq94QKf X-QQ-GoodBg: 0 X-BIZMAIL-ID: 14226334804372199419 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, thomas@t-8ch.de Subject: [PATCH v3 04/12] selftests/nolibc: fix up compile warning with glibc on x86_64 Date: Sat, 3 Jun 2023 16:05:30 +0800 Message-Id: <0626464891e7fc938e6f7a55f1f475f31fbc6f37.1685777982.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767670510038090118?= X-GMAIL-MSGID: =?utf-8?q?1767670510038090118?= Compiling nolibc-test.c with gcc on x86_64 got such warning: tools/testing/selftests/nolibc/nolibc-test.c: In function ‘expect_eq’: tools/testing/selftests/nolibc/nolibc-test.c:177:24: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 177 | llen += printf(" = %lld ", expr); | ~~~^ ~~~~ | | | | | uint64_t {aka long unsigned int} | long long int | %ld It because that glibc defines uint64_t as "unsigned long int" when word size (means sizeof(long)) is 64bit (see include/bits/types.h), but nolibc directly use the 64bit "unsigned long long" (see tools/include/nolibc/stdint.h), which is simpler, seems kernel uses it too (include/uapi/asm-generic/int-ll64.h). use a simple conversion to solve it. Suggested-by: Willy Tarreau Link: https://lore.kernel.org/linux-riscv/20230529130449.GA2813@1wt.eu/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index d417ca5d976f..403f6255c177 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -174,7 +174,7 @@ static int expect_eq(uint64_t expr, int llen, uint64_t val) { int ret = !(expr == val); - llen += printf(" = %lld ", expr); + llen += printf(" = %lld ", (long long)expr); pad_spc(llen, 64, ret ? "[FAIL]\n" : " [OK]\n"); return ret; }