From patchwork Mon Jul 31 06:26: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: 13333664 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 587A9C41513 for ; Mon, 31 Jul 2023 06:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229500AbjGaG1E (ORCPT ); Mon, 31 Jul 2023 02:27:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbjGaG1D (ORCPT ); Mon, 31 Jul 2023 02:27:03 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1BCBE57; Sun, 30 Jul 2023 23:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1690784818; bh=ZTNcL4vPTjZ60aMHUaWTT+59KbRfzXeF9WrWuByRCEI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ruZdxOu/eS/x3/+CLg+xzeVSY2IKEkodIm3Pz6b0M9r99xWRNWQ1b7JQModhN6Cva h0NrlgrkRBYe4gHBmoidnteUOzwfqYVHWgj416iB6EfxPLmD0QsCAe00gtbdC0OaqC Q2GG9bcZOu/a8ttRKlKnvzcJZDSn/B/bamdymzPQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 31 Jul 2023 08:26:56 +0200 Subject: [PATCH 1/4] selftests/nolibc: drop unused test helpers MIME-Version: 1.0 Message-Id: <20230731-nolibc-warnings-v1-1-74973d2a52d7@weissschuh.net> References: <20230731-nolibc-warnings-v1-0-74973d2a52d7@weissschuh.net> In-Reply-To: <20230731-nolibc-warnings-v1-0-74973d2a52d7@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=1690784818; l=4552; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=ZTNcL4vPTjZ60aMHUaWTT+59KbRfzXeF9WrWuByRCEI=; b=t3OE1zDz2rqRRHzMsf9yzWP9Si7c7FBETEnjLOpezbzOQsTduTB7DDKYWmO1G4ASQJsw01jK+ RA17MHV1rFtAjjTQeUJU26jwDOzHkSRSu+ECvk0XAnv6Y3p1FbDRaQ2 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org As we want to enable compiler warnings in the future these would be reported as unused functions. If we need them in the future they are easy to recreate from their still existing siblings. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 99 ---------------------------- 1 file changed, 99 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 03b1d30f5507..53e2d448eded 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -161,31 +161,6 @@ static void result(int llen, enum RESULT r) * of failures, thus either 0 or 1. */ -#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) -{ - int ret = !(expr == 0); - - llen += printf(" = %d ", expr); - result(llen, ret ? FAIL : OK); - return ret; -} - - -#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) -{ - int ret = !(expr != 0); - - llen += printf(" = %d ", expr); - result(llen, ret ? FAIL : OK); - return ret; -} - #define EXPECT_EQ(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_eq(expr, llen, val); } while (0) @@ -239,19 +214,6 @@ 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) -{ - int ret = !(expr <= val); - - llen += printf(" = %d ", expr); - result(llen, ret ? FAIL : OK); - return ret; -} - - #define EXPECT_LT(cond, expr, val) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_lt(expr, llen, val); } while (0) @@ -348,24 +310,6 @@ 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) -{ - int ret = 0; - - llen += printf(" = <%p> ", expr); - if (expr) { - ret = 1; - result(llen, FAIL); - } else { - result(llen, OK); - } - return ret; -} - - #define EXPECT_PTRNZ(cond, expr) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrnz(expr, llen); } while (0) @@ -417,18 +361,6 @@ static int expect_ptrne(const void *expr, int llen, const void *cmp) return ret; } -#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) -{ - int ret = !(expr >= cmp); - - llen += printf(" = <%p> ", expr); - result(llen, ret ? FAIL : OK); - return ret; -} - #define EXPECT_PTRGT(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrgt(expr, llen, cmp); } while (0) @@ -442,19 +374,6 @@ 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) -{ - int ret = !(expr <= cmp); - - llen += printf(" = <%p> ", expr); - result(llen, ret ? FAIL : OK); - return ret; -} - - #define EXPECT_PTRLT(cond, expr, cmp) \ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrlt(expr, llen, cmp); } while (0) @@ -546,24 +465,6 @@ 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) -{ - int ret = 0; - - llen += printf(" = <%s> ", expr); - if (strcmp(expr, cmp) == 0) { - ret = 1; - result(llen, FAIL); - } else { - result(llen, OK); - } - return ret; -} - - /* declare tests based on line numbers. There must be exactly one test per line. */ #define CASE_TEST(name) \ case __LINE__: llen += printf("%d %s", test, #name); From patchwork Mon Jul 31 06:26: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: 13333661 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 CFD52C001DE for ; Mon, 31 Jul 2023 06:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230077AbjGaG1C (ORCPT ); Mon, 31 Jul 2023 02:27:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbjGaG1B (ORCPT ); Mon, 31 Jul 2023 02:27:01 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF3D51A3; Sun, 30 Jul 2023 23:27:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1690784818; bh=k9l2McklzZ+f7yRkzY3nh6NN3e/IqcLnQTelqUxUMw8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=n9igOyZGuaqKnQVBE5HfbFFsddmIwBR9WR4ZmGbZrNSe25048Ohf6zphGVYGNuWoF G/mcZcfL4ZtiPeReeA39j8/4bmWou/ynYarqyHj14A35hXRgWBQYA1adhm8NDVRIJc JK3pyawT4fz4lGn++rCtyEuDhClYUKJuovYcW2wU= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 31 Jul 2023 08:26:57 +0200 Subject: [PATCH 2/4] selftests/nolibc: drop unused variables MIME-Version: 1.0 Message-Id: <20230731-nolibc-warnings-v1-2-74973d2a52d7@weissschuh.net> References: <20230731-nolibc-warnings-v1-0-74973d2a52d7@weissschuh.net> In-Reply-To: <20230731-nolibc-warnings-v1-0-74973d2a52d7@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=1690784818; l=1029; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=k9l2McklzZ+f7yRkzY3nh6NN3e/IqcLnQTelqUxUMw8=; b=aJonl+8VdC7MJHCYyAUY48LuP1WOU57ea5CAhF2u1SPA6lIUOjRsfNDoKxZMc047hBCDfCuNU zaJ4m2GdcOWCTdv2NApJXy8//W/CSAv1pUpFT0ySGEf+epkGIY6p5Sn 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 53e2d448eded..3064191681d0 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -786,9 +786,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 */ @@ -929,9 +927,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 Mon Jul 31 06:26: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: 13333665 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 F273CC04FE0 for ; Mon, 31 Jul 2023 06:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbjGaG1F (ORCPT ); Mon, 31 Jul 2023 02:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230205AbjGaG1C (ORCPT ); Mon, 31 Jul 2023 02:27:02 -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 A4895E6F; Sun, 30 Jul 2023 23:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1690784818; bh=LvmZQIdIvROwNs8BBjCvj4x9lJTSLnFE4blB41Pgq2w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gvI2i/X5im2ahZdFvSaVa9KNeP4jeORaiNKeL5hHIKbj7TdHojC0P3yxe27+9vXDB IkTpnZnRkODOsuw3JZy/467zaayIKLPq+ri1+h0lrnJykGmn9OVP52+fBpSZCbo0VT 3p+6pOk8AJc0C73ATLSFkluNZNzF5TstrbFgh8bg= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 31 Jul 2023 08:26:58 +0200 Subject: [PATCH 3/4] tools/nolibc: drop unused variables MIME-Version: 1.0 Message-Id: <20230731-nolibc-warnings-v1-3-74973d2a52d7@weissschuh.net> References: <20230731-nolibc-warnings-v1-0-74973d2a52d7@weissschuh.net> In-Reply-To: <20230731-nolibc-warnings-v1-0-74973d2a52d7@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=1690784818; l=540; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=LvmZQIdIvROwNs8BBjCvj4x9lJTSLnFE4blB41Pgq2w=; b=uwkXwy2v/nU5enWds8bgac9/9EudpZ4Km0p/0z+y//9evIaD0SxhTOxLGiuSv2wbkIpsbPh9+ VHlsEtREOZeCZrRJUNccRh1kWOpJSaWWSnyyOu+PDxK02XH3+hzR4hg 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 8bfe7db20b80..889ccf5f0d56 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 Mon Jul 31 06:26:59 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: 13333663 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 12009C001DF for ; Mon, 31 Jul 2023 06:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230220AbjGaG1E (ORCPT ); Mon, 31 Jul 2023 02:27:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbjGaG1C (ORCPT ); Mon, 31 Jul 2023 02:27:02 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBC9DE71; Sun, 30 Jul 2023 23:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1690784819; bh=9qdnbLtbhPht0XjyjkFBgcqvEDUXoH/3gWDSG61Kn34=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JILPw/4U6Cko7x2HlkTjmMh/EQ53PmnQ8Sr+R5MgmPWYmUBfljFaI7Mn5rsXnUSNL vJPA7ZEXmHBVdLETcZAuS1bSJGmbmW/4hSVd3IXpLQE8JANxG0TBBFtfAC0FcXg8Eb cVLfmXnJbuwXsftKIlKZeDNmxSyqu6Q/RagfXGdk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 31 Jul 2023 08:26:59 +0200 Subject: [PATCH 4/4] selftests/nolibc: enable -Wall compiler warnings MIME-Version: 1.0 Message-Id: <20230731-nolibc-warnings-v1-4-74973d2a52d7@weissschuh.net> References: <20230731-nolibc-warnings-v1-0-74973d2a52d7@weissschuh.net> In-Reply-To: <20230731-nolibc-warnings-v1-0-74973d2a52d7@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=1690784818; l=913; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=9qdnbLtbhPht0XjyjkFBgcqvEDUXoH/3gWDSG61Kn34=; b=O0FkQ9DeQVyJzEUUjHX/mRWQwt9DHx2IGJP8JAcnKjDRiR29iJZHRpdUleo1NqdrCrv73AKr8 5Pu3O3jPAF1A/aniH6XJHiUihWHCOkSdktGhCnJo2aHIJHKdiIJ6F6k 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 f42adef87e12..72227d75c6da 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 -Wall \ $(call cc-option,-fno-stack-protector) \ $(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR) LDFLAGS := -s