From patchwork Thu Aug 3 07:28:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339361 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 54281C41513 for ; Thu, 3 Aug 2023 07:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232387AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbjHCH2w (ORCPT ); Thu, 3 Aug 2023 03:28:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF7692728; Thu, 3 Aug 2023 00:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047728; bh=KUq+Z6mBKlGZgjoNtyoT13RhBRgveu43YIN2WjHIqHQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JLqozudcDF5reThsW4xR/vFIF7YtkV43chGK/LHjHwzy/8rhGtZb9BNHAR86umU9u V9heA2CxAQ16ITl6vx4pAp3b3rD/x+7OAX7Nr8lBwpOFPS5CBU8WuOb2PCU6EO9JFW UPTu7dVLVttRsRSr4J419DjZtSG1zAUxRXaA1jzE= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:45 +0200 Subject: [PATCH v3 01/14] tools/nolibc: drop unused variables MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-1-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=540; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=KUq+Z6mBKlGZgjoNtyoT13RhBRgveu43YIN2WjHIqHQ=; b=F88GA5vIxDDOnpVXApthFWAjZoP1+Q9qeOo6gP0vs+IA01yJ7IIbS8E9/m8yi9U+umuqG6Gun 2nlwDGaqsPfAaptBKF0HJRQ9S5/dy2ntpvwwBsZvmd3ek24qrEBUrT0 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Nobody needs it, get rid of it. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 56f63eb48a1b..e12dd962c578 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -738,7 +738,6 @@ static __attribute__((unused)) int open(const char *path, int flags, ...) { mode_t mode = 0; - int ret; if (flags & O_CREAT) { va_list args; From patchwork Thu Aug 3 07:28:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339363 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 CDD9FC0015E for ; Thu, 3 Aug 2023 07:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232590AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231771AbjHCH2w (ORCPT ); Thu, 3 Aug 2023 03:28:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46BF6272A; Thu, 3 Aug 2023 00:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047728; bh=Kc+QdIXEiriZU7G8O0tQxJI0UlyXn+ahx8/7NZv6UOI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BMh1bDsk6/kxaJrHT6o97UVSd6wbtiq/uu64gzptWH2Ws3t3UADHmCGpm//BfQVGt j5Snvsm9ei6gW9FtSFuGmBBJ7olzU1++pvIyRAMpGTlBnn/Zc1n3A02XV39JnD7lc6 jMntC4aSUERO6vMVgP4xVmSbJpL11M4rDZqopRk8= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:46 +0200 Subject: [PATCH v3 02/14] tools/nolibc: fix return type of getpagesize() MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-2-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1272; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Kc+QdIXEiriZU7G8O0tQxJI0UlyXn+ahx8/7NZv6UOI=; b=u/P0udBpE4q6UzvgDTxFjgz2+bHM5uIMee8vumQczRMeEd5B8Qlfkf4PJu4x4TCaiC/LeylD9 Es7vLxLlhTADwKVNUwV7OV6umoHFR8m5a6wbNkY/r1bDCLMbDV60y7R X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org It's documented as returning int which is also implemented by glibc and musl, so adopt that return type. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 4 ++-- tools/testing/selftests/nolibc/nolibc-test.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index e12dd962c578..c151533ba8e9 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -460,11 +460,11 @@ pid_t gettid(void) static unsigned long getauxval(unsigned long key); /* - * long getpagesize(void); + * int getpagesize(void); */ static __attribute__((unused)) -long getpagesize(void) +int getpagesize(void) { return __sysret(getauxval(AT_PAGESZ) ?: -ENOENT); } diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 3a21bee360ea..52489455add8 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -636,7 +636,7 @@ int test_getdents64(const char *dir) static int test_getpagesize(void) { - long x = getpagesize(); + int x = getpagesize(); int c; if (x < 0) From patchwork Thu Aug 3 07:28:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339360 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 AADABC001E0 for ; Thu, 3 Aug 2023 07:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232226AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230523AbjHCH2w (ORCPT ); Thu, 3 Aug 2023 03:28:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70471187; Thu, 3 Aug 2023 00:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047728; bh=Dq8jbZTyhLjjfrXzMVP5XMUcw7zpYJiDlah00ed3ZfA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KHa0PEaHkP20XujShvLhET41cKqgvBcTEeUXjNBa8W9xU864D9jwX8k8zpM4lloLJ r5/aPAG5R6IpbYdNPuTcxm26O04yEo6+fX2ELLcgqxtgCRhBb3/TUafcnJ0JKQHI0C Wlwo6qz4SyJKj5d6xwvbM6BDPSz/UivF/GShLT6U= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:47 +0200 Subject: [PATCH v3 03/14] tools/nolibc: setvbuf: avoid unused parameter warnings MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-3-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=810; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Dq8jbZTyhLjjfrXzMVP5XMUcw7zpYJiDlah00ed3ZfA=; b=y/x5UwahV+LCwccwghbOr9hgOU+M1lJT3l4QTOWofdAIStedWSwlXVZEe9082mVNHVjngX1QT m1550V64flcD7+j7YdZAfdVtF5nsfMp2kAWLHEJ6HoA5x+0i2Nkhfyy X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This warning will be enabled later so avoid triggering it. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdio.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h index a3778aff4fa9..cae402c11e57 100644 --- a/tools/include/nolibc/stdio.h +++ b/tools/include/nolibc/stdio.h @@ -356,7 +356,10 @@ void perror(const char *msg) } static __attribute__((unused)) -int setvbuf(FILE *stream, char *buf, int mode, size_t size) +int setvbuf(FILE *stream __attribute__((unused)), + char *buf __attribute__((unused)), + int mode, + size_t size __attribute__((unused))) { /* * nolibc does not support buffering so this is a nop. Just check mode From patchwork Thu Aug 3 07:28:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339366 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 9587DC04A94 for ; Thu, 3 Aug 2023 07:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232705AbjHCH26 (ORCPT ); Thu, 3 Aug 2023 03:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232080AbjHCH2w (ORCPT ); Thu, 3 Aug 2023 03:28:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 354302D6A; Thu, 3 Aug 2023 00:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047728; bh=iyNHuyFIri0jOYpPmNaXlYmA/yRvazXiYVqNbQvn0aU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E5yZKMaXfMDcQ/MX0pRsZBQWf6pZojYuI1Pwm4z6w7hhVsVENXrH8a1+Ql5rNZR0m bfRAuZ/hwFedoX0F2vuLwV9GNziF3rkJLk9wijv89ehEts6l574XX6RxK4hO8bFdq4 vFyrf1ykG59kT3PVcHZ/PasLqvG8ZaRyKwDwKz0Y= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:48 +0200 Subject: [PATCH v3 04/14] tools/nolibc: sys: avoid implicit sign cast MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-4-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=702; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=iyNHuyFIri0jOYpPmNaXlYmA/yRvazXiYVqNbQvn0aU=; b=SdXAr1nPJemUkaNkDtnvzdItVrwOJcTSgFgDli3ZAyQlj1UF07hIZH3b5znuC4sOs+HytEHEL e3r3dEQzSeVDGMN3vbUKh7fFprXjSduqd+F2TbnPDKo5jBq03UZCaOY X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org getauxval() returns an unsigned long but the overall type of the ternary operator needs to be signed. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index c151533ba8e9..833d6c5e86dc 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -466,7 +466,7 @@ static unsigned long getauxval(unsigned long key); static __attribute__((unused)) int getpagesize(void) { - return __sysret(getauxval(AT_PAGESZ) ?: -ENOENT); + return __sysret((int)getauxval(AT_PAGESZ) ?: -ENOENT); } From patchwork Thu Aug 3 07:28:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339368 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 63EB9C0015E for ; Thu, 3 Aug 2023 07:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233339AbjHCH27 (ORCPT ); Thu, 3 Aug 2023 03:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A1ED30D5; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=K1nxWE0fnm2Rd+ee1CtTMEzoebCOmluJAHtmf4S2JYw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=d3oYr9ZKnj81yRNQs7tguKWRZj+K+kOD9aCvxHPy9sln2oa8ZNdOGxPxAC3ZyE9o8 6amfOuVyomwybMZoLE5XSQ1VpDwXVFPd25so9KO64tXuyJ8IRl6AtVlAgk/KxCT7Ja abX6rrF3TPhctcQVoi5qTqmXXhgxtxC9mIQ2eJgc= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:49 +0200 Subject: [PATCH v3 05/14] tools/nolibc: stdint: use int for size_t on 32bit MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-5-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1072; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=K1nxWE0fnm2Rd+ee1CtTMEzoebCOmluJAHtmf4S2JYw=; b=c9Cgu8bto58cOlvZooH2C/yq8ewDPwtBzS6vev6ZRrqlH0do7tsxTiV75lYiOPpWXJvbOhhxV LWNXjln6xFtC8i/+MTZ4YavCk/Ik+vvihxujZIEb8spYbYMEvi9lw+S X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 typedef signed long ssize_t; typedef unsigned long uintptr_t; typedef signed long intptr_t; From patchwork Thu Aug 3 07:28:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339365 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 1BBA6C04FDF for ; Thu, 3 Aug 2023 07:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232805AbjHCH25 (ORCPT ); Thu, 3 Aug 2023 03:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03E7630CA; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=FYW5QoP5+S9dB6umlL+oN4HnFsDZi3fajwjXFuBeuUU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oMQtMHW2hK8MsDIGfxKj8QjxtaszAil3iqby3nulpaimVFdvLIt+byK+Hw4lftq0J I701Ixx5pTSl6yAR6mqb62v12M2OtSPZ5Emv4/7csGRX1f3VuAv8OGsWvruJZnRcw2 NbJ45WZBMBt4CizWfdJfQd3CjTMOWjUgWt2jbNH4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:50 +0200 Subject: [PATCH v3 06/14] selftests/nolibc: drop unused variables MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-6-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1031; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=FYW5QoP5+S9dB6umlL+oN4HnFsDZi3fajwjXFuBeuUU=; b=he62Hb+5paDBtJB0GmwLNxnwaODM5oItQzKuC9iP8SNeUOCQ8UB0xUKooDaG0vcYpYzy2BkES vYmj39D9oVlBl2AN9Kk2W+9HV8KtfK4ojW1isYN8e2g73HOKeOxSDDQ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org These got copied around as new testcases where created. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 52489455add8..cff441c17f3e 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -908,9 +908,7 @@ int run_syscall(int min, int max) int run_stdlib(int min, int max) { int test; - int tmp; int ret = 0; - void *p1, *p2; for (test = min; test >= 0 && test <= max; test++) { int llen = 0; /* line length */ @@ -1051,9 +1049,7 @@ static int expect_vfprintf(int llen, size_t c, const char *expected, const char static int run_vfprintf(int min, int max) { int test; - int tmp; int ret = 0; - void *p1, *p2; for (test = min; test >= 0 && test <= max; test++) { int llen = 0; /* line length */ From patchwork Thu Aug 3 07:28:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339373 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 7124DC04E69 for ; Thu, 3 Aug 2023 07:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233875AbjHCH3E (ORCPT ); Thu, 3 Aug 2023 03:29:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1828530E2; Thu, 3 Aug 2023 00:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=7aEZiIikmC4dKxk18WeIZWuHGVLO6UKYLRF2uAPpdO8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cj9GrobY/1w3hDNxpr4Zm1kL8BwyH/MqQxk1lqSc06VM2+yzhPA4Xu/pKpAa2rnqp /qc+Q5gQ5Q/c8YPlfdlj8CwkXMLbUjNnGAarJTfniCD0lLWov95C4BZdbFsA9DJhXD xYIyXw8ObFwsJrKnyndSy4IbreOHNvNaFJWTec4g= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:51 +0200 Subject: [PATCH v3 07/14] selftests/nolibc: mark test helpers as potentially unused MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-7-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=10728; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=7aEZiIikmC4dKxk18WeIZWuHGVLO6UKYLRF2uAPpdO8=; b=3A2jdKeeuWHO4uH9MrH+U9tE7ow7q71eJ2fIj4ScJ6fyFsSP4JkrNV/nDUfvQkRjzS5qgYDn9 BuiDQhHFWtuAZ/M1h/PbcjzhHi6HxQjwVVq0CAqX3NbP41nFdd9pEuf X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org When warning about unused functions these would be reported by we want to keep them for future use. Suggested-by: Zhangjin Wu Link: https://lore.kernel.org/lkml/20230731064826.16584-1-falcon@tinylab.org/ Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/20230731224929.GA18296@1wt.eu/ Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 75 ++++++++++++++++++---------- 1 file changed, 50 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index cff441c17f3e..154ec4787e8d 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -165,7 +165,8 @@ static void result(int llen, enum RESULT r) #define EXPECT_ZR(cond, expr) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_zr(expr, llen); } while (0) -static int expect_zr(int expr, int llen) +static __attribute__((unused)) +int expect_zr(int expr, int llen) { int ret = !(expr == 0); @@ -178,7 +179,8 @@ static int expect_zr(int expr, int llen) #define EXPECT_NZ(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_nz(expr, llen; } while (0) -static int expect_nz(int expr, int llen) +static __attribute__((unused)) +int expect_nz(int expr, int llen) { int ret = !(expr != 0); @@ -191,7 +193,8 @@ static int expect_nz(int expr, int llen) #define EXPECT_EQ(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_eq(expr, llen, val); } while (0) -static int expect_eq(uint64_t expr, int llen, uint64_t val) +static __attribute__((unused)) +int expect_eq(uint64_t expr, int llen, uint64_t val) { int ret = !(expr == val); @@ -204,7 +207,8 @@ static int expect_eq(uint64_t expr, int llen, uint64_t val) #define EXPECT_NE(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ne(expr, llen, val); } while (0) -static int expect_ne(int expr, int llen, int val) +static __attribute__((unused)) +int expect_ne(int expr, int llen, int val) { int ret = !(expr != val); @@ -217,7 +221,8 @@ static int expect_ne(int expr, int llen, int val) #define EXPECT_GE(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ge(expr, llen, val); } while (0) -static int expect_ge(int expr, int llen, int val) +static __attribute__((unused)) +int expect_ge(int expr, int llen, int val) { int ret = !(expr >= val); @@ -230,7 +235,8 @@ static int expect_ge(int expr, int llen, int val) #define EXPECT_GT(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_gt(expr, llen, val); } while (0) -static int expect_gt(int expr, int llen, int val) +static __attribute__((unused)) +int expect_gt(int expr, int llen, int val) { int ret = !(expr > val); @@ -243,7 +249,8 @@ static int expect_gt(int expr, int llen, int val) #define EXPECT_LE(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_le(expr, llen, val); } while (0) -static int expect_le(int expr, int llen, int val) +static __attribute__((unused)) +int expect_le(int expr, int llen, int val) { int ret = !(expr <= val); @@ -256,7 +263,8 @@ static int expect_le(int expr, int llen, int val) #define EXPECT_LT(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_lt(expr, llen, val); } while (0) -static int expect_lt(int expr, int llen, int val) +static __attribute__((unused)) +int expect_lt(int expr, int llen, int val) { int ret = !(expr < val); @@ -269,7 +277,8 @@ static int expect_lt(int expr, int llen, int val) #define EXPECT_SYSZR(cond, expr) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_syszr(expr, llen); } while (0) -static int expect_syszr(int expr, int llen) +static __attribute__((unused)) +int expect_syszr(int expr, int llen) { int ret = 0; @@ -288,7 +297,8 @@ static int expect_syszr(int expr, int llen) #define EXPECT_SYSEQ(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_syseq(expr, llen, val); } while (0) -static int expect_syseq(int expr, int llen, int val) +static __attribute__((unused)) +int expect_syseq(int expr, int llen, int val) { int ret = 0; @@ -307,7 +317,8 @@ static int expect_syseq(int expr, int llen, int val) #define EXPECT_SYSNE(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_sysne(expr, llen, val); } while (0) -static int expect_sysne(int expr, int llen, int val) +static __attribute__((unused)) +int expect_sysne(int expr, int llen, int val) { int ret = 0; @@ -329,7 +340,8 @@ static int expect_sysne(int expr, int llen, int val) #define EXPECT_SYSER(cond, expr, expret, experr) \ EXPECT_SYSER2(cond, expr, expret, experr, 0) -static int expect_syserr2(int expr, int expret, int experr1, int experr2, int llen) +static __attribute__((unused)) +int expect_syserr2(int expr, int expret, int experr1, int experr2, int llen) { int ret = 0; int _errno = errno; @@ -352,7 +364,8 @@ static int expect_syserr2(int expr, int expret, int experr1, int experr2, int ll #define EXPECT_PTRZR(cond, expr) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrzr(expr, llen); } while (0) -static int expect_ptrzr(const void *expr, int llen) +static __attribute__((unused)) +int expect_ptrzr(const void *expr, int llen) { int ret = 0; @@ -370,7 +383,8 @@ static int expect_ptrzr(const void *expr, int llen) #define EXPECT_PTRNZ(cond, expr) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrnz(expr, llen); } while (0) -static int expect_ptrnz(const void *expr, int llen) +static __attribute__((unused)) +int expect_ptrnz(const void *expr, int llen) { int ret = 0; @@ -387,7 +401,8 @@ static int expect_ptrnz(const void *expr, int llen) #define EXPECT_PTREQ(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptreq(expr, llen, cmp); } while (0) -static int expect_ptreq(const void *expr, int llen, const void *cmp) +static __attribute__((unused)) +int expect_ptreq(const void *expr, int llen, const void *cmp) { int ret = 0; @@ -404,7 +419,8 @@ static int expect_ptreq(const void *expr, int llen, const void *cmp) #define EXPECT_PTRNE(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrne(expr, llen, cmp); } while (0) -static int expect_ptrne(const void *expr, int llen, const void *cmp) +static __attribute__((unused)) +int expect_ptrne(const void *expr, int llen, const void *cmp) { int ret = 0; @@ -421,7 +437,8 @@ static int expect_ptrne(const void *expr, int llen, const void *cmp) #define EXPECT_PTRGE(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrge(expr, llen, cmp); } while (0) -static int expect_ptrge(const void *expr, int llen, const void *cmp) +static __attribute__((unused)) +int expect_ptrge(const void *expr, int llen, const void *cmp) { int ret = !(expr >= cmp); @@ -433,7 +450,8 @@ static int expect_ptrge(const void *expr, int llen, const void *cmp) #define EXPECT_PTRGT(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrgt(expr, llen, cmp); } while (0) -static int expect_ptrgt(const void *expr, int llen, const void *cmp) +static __attribute__((unused)) +int expect_ptrgt(const void *expr, int llen, const void *cmp) { int ret = !(expr > cmp); @@ -446,7 +464,8 @@ static int expect_ptrgt(const void *expr, int llen, const void *cmp) #define EXPECT_PTRLE(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrle(expr, llen, cmp); } while (0) -static int expect_ptrle(const void *expr, int llen, const void *cmp) +static __attribute__((unused)) +int expect_ptrle(const void *expr, int llen, const void *cmp) { int ret = !(expr <= cmp); @@ -459,7 +478,8 @@ static int expect_ptrle(const void *expr, int llen, const void *cmp) #define EXPECT_PTRLT(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrlt(expr, llen, cmp); } while (0) -static int expect_ptrlt(const void *expr, int llen, const void *cmp) +static __attribute__((unused)) +int expect_ptrlt(const void *expr, int llen, const void *cmp) { int ret = !(expr < cmp); @@ -474,7 +494,8 @@ static int expect_ptrlt(const void *expr, int llen, const void *cmp) #define EXPECT_PTRER(cond, expr, expret, experr) \ EXPECT_PTRER2(cond, expr, expret, experr, 0) -static int expect_ptrerr2(const void *expr, const void *expret, int experr1, int experr2, int llen) +static __attribute__((unused)) +int expect_ptrerr2(const void *expr, const void *expret, int experr1, int experr2, int llen) { int ret = 0; int _errno = errno; @@ -496,7 +517,8 @@ static int expect_ptrerr2(const void *expr, const void *expret, int experr1, int #define EXPECT_STRZR(cond, expr) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strzr(expr, llen); } while (0) -static int expect_strzr(const char *expr, int llen) +static __attribute__((unused)) +int expect_strzr(const char *expr, int llen) { int ret = 0; @@ -514,7 +536,8 @@ static int expect_strzr(const char *expr, int llen) #define EXPECT_STRNZ(cond, expr) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strnz(expr, llen); } while (0) -static int expect_strnz(const char *expr, int llen) +static __attribute__((unused)) +int expect_strnz(const char *expr, int llen) { int ret = 0; @@ -532,7 +555,8 @@ static int expect_strnz(const char *expr, int llen) #define EXPECT_STREQ(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_streq(expr, llen, cmp); } while (0) -static int expect_streq(const char *expr, int llen, const char *cmp) +static __attribute__((unused)) +int expect_streq(const char *expr, int llen, const char *cmp) { int ret = 0; @@ -550,7 +574,8 @@ static int expect_streq(const char *expr, int llen, const char *cmp) #define EXPECT_STRNE(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strne(expr, llen, cmp); } while (0) -static int expect_strne(const char *expr, int llen, const char *cmp) +static __attribute__((unused)) +int expect_strne(const char *expr, int llen, const char *cmp) { int ret = 0; From patchwork Thu Aug 3 07:28:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339374 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 1242AC04A6A for ; Thu, 3 Aug 2023 07:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233886AbjHCH3F (ORCPT ); Thu, 3 Aug 2023 03:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B74CC30DA; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=Bsog0Mf6TrXFPK5NCHSwt3Qj4UKD19LdkghQ5BZEmxg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LXyQLw5NM/Oe9Xu12DPpC769c6UF3r50FEMf0cdoLRblw0DhqzHGWRuHqi3XK50w+ 2EmfvwP97/YzHoyvAFDei/E+3a9ApLZFVH3gAySn//QBID7aVm/psgrO3qUXZAbwLj +M7+XGO9B+GjsjPLXmAUgDGYzxpioi81vJXcPDu8= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:52 +0200 Subject: [PATCH v3 08/14] selftests/nolibc: make functions static if possible MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-8-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1835; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Bsog0Mf6TrXFPK5NCHSwt3Qj4UKD19LdkghQ5BZEmxg=; b=6bN7cO3nPs3BnEWlMB22XPWZvlNXbV6YYCr1ADIkFpYMKeskTrlYAiPgsG0Hvx83/fMhS4PFA 8/f1DrEBKcmDIFpU5gdml9rFlW+ibQ4LzIZOimZdANh+Mu98XuXkHSq X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This allows the compiler to generate warnings if they go unused. Functions that are supposed to be used as breakpoints should not be static, so un-statify those if necessary. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 154ec4787e8d..ea420c794536 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -80,7 +80,7 @@ char *itoa(int i) /* returns the error name (e.g. "ENOENT") for common errors, "SUCCESS" for 0, * or the decimal value for less common ones. */ -const char *errorname(int err) +static const char *errorname(int err) { switch (err) { case 0: return "SUCCESS"; @@ -659,7 +659,7 @@ int test_getdents64(const char *dir) return ret; } -static int test_getpagesize(void) +int test_getpagesize(void) { int x = getpagesize(); int c; @@ -688,7 +688,7 @@ static int test_getpagesize(void) return !c; } -static int test_fork(void) +int test_fork(void) { int status; pid_t pid; @@ -713,7 +713,7 @@ static int test_fork(void) } } -static int test_stat_timestamps(void) +int test_stat_timestamps(void) { struct stat st; @@ -793,7 +793,7 @@ int test_mmap_munmap(void) return !!ret; } -static int test_pipe(void) +int test_pipe(void) { const char *const msg = "hello, nolibc"; int pipefd[2]; @@ -1231,7 +1231,7 @@ static const struct test test_names[] = { { 0 } }; -int is_setting_valid(char *test) +static int is_setting_valid(char *test) { int idx, len, test_len, valid = 0; char delimiter; From patchwork Thu Aug 3 07:28:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339364 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 3A798C001E0 for ; Thu, 3 Aug 2023 07:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbjHCH25 (ORCPT ); Thu, 3 Aug 2023 03:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232107AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B7730CF; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=SiXyuOOX0kAfgATp0YbPKnf7iVUwVHLjveWTNqqssiQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hezgaGxRLIRMLpdr1R+Wsv3oxbMjbLxk5lOLBNIMFPM20GFGmpZ33B3okuHlqkbKW HgN7x0AvLODroFjwDfuWQlRogfJUAZ6pw4K8d2mCWKAuIFmCcxeZHLFA/sFdMBwMda WnwHWZGA2kX48+4+iRUaufOvWrGotJrOx5GN5xms= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:53 +0200 Subject: [PATCH v3 09/14] selftests/nolibc: avoid unused parameter warnings MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-9-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=758; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=SiXyuOOX0kAfgATp0YbPKnf7iVUwVHLjveWTNqqssiQ=; b=Q/BdMVls6YdyJeCvodtEdoB0Szlesfpr7ZaJZrW87s6bj1cDnCYLCF3ffhM7qtMKZ5hSLkYW7 ZitYAgLlZwrD7Al8FbR8+cwSAm5D9sDwv++Rtwpkqg4OY1sSjuEm+vu X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This warning will be enabled later so avoid triggering it. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index ea420c794536..d6aa12c3f9ff 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1112,7 +1112,8 @@ static int smash_stack(void) return 1; } -static int run_protection(int min, int max) +static int run_protection(int min __attribute__((unused)), + int max __attribute__((unused))) { pid_t pid; int llen = 0, status; From patchwork Thu Aug 3 07:28:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339367 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 7576AC04A6A for ; Thu, 3 Aug 2023 07:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233321AbjHCH27 (ORCPT ); Thu, 3 Aug 2023 03:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13F4530D3; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=7/upWQanP2NdVX/m2HsjLqivjxgPsVRP62MNXJPVjBs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pDCJQB/6zSpH57Tm0znGvuuTr48rVmGwWK+gxxzbT1uZ6l9v3D94yJ3zMCx01Yu3w JQSHvrzFzK/d2gggLQtGpaa2ARHTb62C3jdcoXq6jaalffGB7WIk0ALWbXgKfH0Ddh qFtBmd/WR5P6Ek+DZtIkjNC6w2waEIz9YO0PS3MU= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:54 +0200 Subject: [PATCH v3 10/14] selftests/nolibc: avoid sign-compare warnings MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-10-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1503; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=7/upWQanP2NdVX/m2HsjLqivjxgPsVRP62MNXJPVjBs=; b=xlSvro4wwyBj3Yf5UMu6IxMPThA02+KbWyFtkG9C+3wj3599ZfkxP1KA7qJUBL0Jp5smv3vop 0YnzSAL5MCXC7xBNeaNaIgxqJ24fQr08g30dknm0qRcY66CulIs20ts X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org These warnings will be enabled later so avoid triggering them. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index d6aa12c3f9ff..0ab241d61508 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -737,9 +737,9 @@ int test_stat_timestamps(void) int test_mmap_munmap(void) { - int ret, fd, i; + int ret, fd, i, page_size; void *mem; - size_t page_size, file_size, length; + size_t file_size, length; off_t offset, pa_offset; struct stat stat_buf; const char * const files[] = { @@ -1021,7 +1021,7 @@ int run_stdlib(int min, int max) #define EXPECT_VFPRINTF(c, expected, fmt, ...) \ ret += expect_vfprintf(llen, c, expected, fmt, ##__VA_ARGS__) -static int expect_vfprintf(int llen, size_t c, const char *expected, const char *fmt, ...) +static int expect_vfprintf(int llen, int c, const char *expected, const char *fmt, ...) { int ret, fd, w, r; char buf[100]; @@ -1045,7 +1045,7 @@ static int expect_vfprintf(int llen, size_t c, const char *expected, const char va_end(args); if (w != c) { - llen += printf(" written(%d) != %d", w, (int) c); + llen += printf(" written(%d) != %d", w, c); result(llen, FAIL); return 1; } From patchwork Thu Aug 3 07:28:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339370 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 7C790C04A94 for ; Thu, 3 Aug 2023 07:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232987AbjHCH3B (ORCPT ); Thu, 3 Aug 2023 03:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232330AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9606A187; Thu, 3 Aug 2023 00:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=FOosJH/CmUX2d0gi9dET+M4ykNx0gigEkRwzseP0iBQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mFfiRKlyRQ1RA8jAfiLWQNaBJouglzSvWbjxpUEHbrdgJGElid8O7uGRRKCNDkata Lm6yvEGonFX+awVTZ0VkBWNQEqPBau8BSTZTgGH5+LtlRHZ0Fb08Rru/GPjSE7Enoz vZELYSf3f2fXiqXFU385Ds9sucRx16qQJgQR4QpQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:55 +0200 Subject: [PATCH v3 11/14] selftests/nolibc: use correct return type for read() and write() MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-11-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1419; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=FOosJH/CmUX2d0gi9dET+M4ykNx0gigEkRwzseP0iBQ=; b=4jNwczucEessfNJbJG8Wi2UcI2FKtV4G8+Nx0CetT9ICUSxSaPgKRg7DdIBB2TwdxoPicmrBM D9BTJZbvnjMC78Q4K/x2E3FsSdqFaUiA6M/Oht8hc9RR+eqyUkW82f4 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Avoid truncating values before comparing them. As printf in nolibc doesn't support ssize_t add casts to int for printing. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 0ab241d61508..63f09800057d 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1023,7 +1023,8 @@ int run_stdlib(int min, int max) static int expect_vfprintf(int llen, int c, const char *expected, const char *fmt, ...) { - int ret, fd, w, r; + int ret, fd; + ssize_t w, r; char buf[100]; FILE *memfile; va_list args; @@ -1045,7 +1046,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm va_end(args); if (w != c) { - llen += printf(" written(%d) != %d", w, c); + llen += printf(" written(%d) != %d", (int)w, c); result(llen, FAIL); return 1; } @@ -1059,7 +1060,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm fclose(memfile); if (r != w) { - llen += printf(" written(%d) != read(%d)", w, r); + llen += printf(" written(%d) != read(%d)", (int)w, (int)r); result(llen, FAIL); return 1; } From patchwork Thu Aug 3 07:28:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339369 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 9A8A7C04E69 for ; Thu, 3 Aug 2023 07:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233700AbjHCH3A (ORCPT ); Thu, 3 Aug 2023 03:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232240AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEBCA30DB; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=EWfkz4+JzA39y3BqrykKODSeqlkEjyKnDKBLfiY+GuE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ig/AE/KgUWfFxj21F5PavNG2qCm5JBdo5042nfha90GMAczwMIY/O9NlmvnbZ3knW EYEIYxbeaLYAtO44FmwMBEp0S1ZD63RBN6MlSBjfWdy+2tRezwF3ocvxK5Tix/jYyu Neftr8nUENgEomhNYVegLkI+kIsTnJPG2mMrsehw= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:56 +0200 Subject: [PATCH v3 12/14] selftests/nolibc: prevent out of bounds access in expect_vfprintf MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-12-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1067; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=EWfkz4+JzA39y3BqrykKODSeqlkEjyKnDKBLfiY+GuE=; b=gJ18WhH9OWXlk9KTnh/w/CexA9VLB/UrRUJQFDwfWfARdOCmeWSBQgfbsGXRx1smLI4+Fcbre zkHVNQjYOHjCWMsimBUOfvx+Y+h5C9RE2QBpLg8ZUpLIRN+YKslVwht X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org If read() fails and returns -1 (or returns garbage for some other reason) buf would be accessed out of bounds. Only use the return value of read() after it has been validated. Signed-off-by: Thomas Weißschuh --- 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 63f09800057d..0145a44af990 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1055,7 +1055,6 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm lseek(fd, 0, SEEK_SET); r = read(fd, buf, sizeof(buf) - 1); - buf[r] = '\0'; fclose(memfile); @@ -1065,6 +1064,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm return 1; } + buf[r] = '\0'; llen += printf(" \"%s\" = \"%s\"", expected, buf); ret = strncmp(expected, buf, c); From patchwork Thu Aug 3 07:28:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339371 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 026E8C0015E for ; Thu, 3 Aug 2023 07:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233822AbjHCH3C (ORCPT ); Thu, 3 Aug 2023 03:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232445AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6F262728; Thu, 3 Aug 2023 00:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=kVg+ddk4XYFgD37LXo7XQQcjwPOqCjh3CHvqXQamr2w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cAcoN1BX1ObfWjGCv6phvqKsfpgbnBqk3tMnlbPkdGwu2L4QFCpSdIQGLLSQYKubB Ul8HB8cJUY8ph5VEBod4gpZGyybH2UN4b87Ya3o3Fhhe2xrFMvALRdtcKv34VtR1lA I862uwOf/t2a8Pmlvyioq6rGxHahJFj1mSBpuDy4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:57 +0200 Subject: [PATCH v3 13/14] selftests/nolibc: don't strip nolibc-test MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-13-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1061; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=kVg+ddk4XYFgD37LXo7XQQcjwPOqCjh3CHvqXQamr2w=; b=me8m7eaLVGWZI/dUtccVBUgYv/VDWJvY1LHvNTScpcUJGo0yI/YQWu4XEiTZ6NCI4kRNfYs19 a2t59EVbMxwCGLQIcj21Hy1TW7EoZMInqcHd0nDCRNq580DBCUi/nuV X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Binary size is not important for nolibc-test and some debugging information is nice to have, so don't strip the binary during linking. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index f42adef87e12..b82d29b6c37f 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -82,7 +82,7 @@ CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \ $(call cc-option,-fno-stack-protector) \ $(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR) -LDFLAGS := -s +LDFLAGS := REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \ END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \ From patchwork Thu Aug 3 07:28:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13339372 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 CD227C001E0 for ; Thu, 3 Aug 2023 07:29:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233682AbjHCH3D (ORCPT ); Thu, 3 Aug 2023 03:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232332AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EB1330E4; Thu, 3 Aug 2023 00:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=1prHYeNa2m6PDgxlomejHbEUeEH+xZuFmSaJoOFEhcA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RnfIHQ4uiH5HSosRYOtPrfz3SG7UZZdVfxMWZIyctFa6g5w98vl7xf4DoXXEhMOkK ij9Uq5rOn/j0634l3LNLEZZTZdSKgezgZuRdM4SgcuZthdPehKrLCvzxaOaBn3FbJy pPHiA1ZYoR5xGxS52k7Je82P7A6Wm9hVUXeLmAcc= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:58 +0200 Subject: [PATCH v3 14/14] selftests/nolibc: enable compiler warnings MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-14-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=921; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=1prHYeNa2m6PDgxlomejHbEUeEH+xZuFmSaJoOFEhcA=; b=gj5nyYlAoM82Al6l1w7dDRxZVxTU9JPlDlrOyLJNu97fgOVQhH4+8ltb5nxU+MiP+nves7IJL z/BUpARrFpkA1mZ/6pgJ8tyToiYcoo9e+OrV7MPLJ/hDUvwY9elLR7H X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org It will help the developers to avoid cruft and detect some bugs. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index b82d29b6c37f..e8d09cbee2ab 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -79,7 +79,7 @@ endif CFLAGS_s390 = -m64 CFLAGS_mips = -EL CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) -CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \ +CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \ $(call cc-option,-fno-stack-protector) \ $(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR) LDFLAGS :=