Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1900577rwo; Thu, 3 Aug 2023 01:15:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlFEQJhL3kwfPePGTVx1m97HvtoCJRWVHOsaetD+wQeMitMTAv/4sZV+cCuvBI6pSf29j8vW X-Received: by 2002:a05:6358:3417:b0:129:c9c0:ca64 with SMTP id h23-20020a056358341700b00129c9c0ca64mr10043017rwd.15.1691050549663; Thu, 03 Aug 2023 01:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691050549; cv=none; d=google.com; s=arc-20160816; b=c+raITttxlMVHVvTWsppDVcp7hYKFmsWIQUrOngCIDVk3I86jd6WeBNhCTaDdqTcRN vNSPW1zZ2W+yW8n1JqzYTTpKJktU6Vua9orah1GB6ojNPVRmBiE36GVdxGlPIvnKTimG dHR8nrdxVKkxa6x4LFGD9CktZv9Iwrq6MNXhzNd5m8Zjr/7/I/90MlnBDo8E/NH4C1sB Q15qX5zmyI0VQVCLeOR3R2m73jadDkPP1V8w6/Pz4FSGVY/q38zfmUtYf1ehgLtEYsS2 Smk2LAcfQgBvgZuuyj8ID+VHxNCXjI9e2xzt0wIQh2fplc/bz5QUAHxSmG7/xClVhIv1 yghw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=RDa0bJF5iWY9qGBZxFECHC/4oDeSSspMItuWqiCnctA=; fh=UZfhiU2pgwvZdBOe9fFEhnfTQX0/6KsvXKQubWsfhik=; b=O/uPXyBkVuFftkS2KsdaK/TSqWBM76jRMSUYcbEtzdfVpuICnFwSarkmumX/iij0cT 5l/w+DEJfhnZos9uIwqvOwxgVhFKX/kVQrLj8oZ0iTnyCSPAf/pzY5Y57uZhsOyyhbkr x8xv4BMxofbQb8q7cLK0wiExxmZ3uxhzcGCObaCyyOJP4lrEoc7ekJBNS9FcVb1Xm2xH iaTwRuZqSs6M1nB5XDyRzUtLg4FzueI5kdAuxNqOViJRC1iNKjz4Yc/D2fFrEj6mkkU0 uiIsCcY2NiJY2U5B4mb9tfQECet92Fo1aes7pz9HHEwVRxbBK1+7aEWRZ+C7IM2F9UbF AO3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b="Rt7/42Hb"; 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 h5-20020a056a00218500b0068658355b40si2620952pfi.162.2023.08.03.01.15.37; Thu, 03 Aug 2023 01:15:49 -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="Rt7/42Hb"; 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 S233884AbjHCH3E (ORCPT + 99 others); Thu, 3 Aug 2023 03:29:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbjHCH2w (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 BCBCB273A; 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=yUN4esrnjSf2QnQqSCJ5RZKfG0ro2Q4ZXEhcrqDqpVQ=; h=From:Subject:Date:To:Cc:From; b=Rt7/42HbfJMXfH0q+rozysM+jqki+XD/tikWspdFlmN7e3zS736J9KKR/p+da3LN9 ESudZ4J4W6iDOoWCeWITo3FiZWL6K10Uxf3Ll1LkIfv1BdL3vYILDRAYLtGnufzMZb 6ezKVKeuo3THIwXhdR+gKxVvDBNFwR3Fpf7ukb8Q= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Subject: [PATCH v3 00/14] tools/nolibc: enable compiler warnings Date: Thu, 03 Aug 2023 09:28:44 +0200 Message-Id: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIACxXy2QC/3XNyw6CMBCF4VchXVvTC1hw5XsYF71JJzHFdLBoC O9uYeNCXf4nmW9mgj6BR3KsZpJ8BoQhlpC7itigY+8puNJEMCGZkpzG4QbG0kmnCLFHag++VqK ttWWSlKt78ld4buL5UjoAjkN6bQ8yX9f/VuaUUVV3SjqhG+HUafKAiDY8wj76kaxgFh+kZT8QU RBudGN1o4zrzBeyLMsb6xL6BPgAAAA= 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=2437; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=yUN4esrnjSf2QnQqSCJ5RZKfG0ro2Q4ZXEhcrqDqpVQ=; b=TG485rZisHA4z6ZfIV+sunCuM4M9eteDd86I4C44cBu2QqtI+gX7t2nXHVhuEBmrQRw+4CMYU s5iSqLSTuOaDGVfVGddW9zXyZjfLJCHrmhduqepHMgYyVp9zfAu52DB X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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,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 To help the developers to avoid mistakes and keep the code smaller let's enable compiler warnings. I stuck with __attribute__((unused)) over __maybe_unused in nolibc-test.c for consistency with nolibc proper. If we want to add a define it needs to be added twice once for nolibc proper and once for nolibc-test otherwise libc-test wouldn't build anymore. Signed-off-by: Thomas Weißschuh --- Changes in v3: - Make getpagesize() return "int" - Simplify validation of read() return value - Don't make functions static that are to be used as breakpoints - Drop -s from LDFLAGS - Use proper types for read()/write() return values - Fix unused parameter warnings in new setvbuf() - Link to v2: https://lore.kernel.org/r/20230801-nolibc-warnings-v2-0-1ba5ca57bd9b@weissschuh.net Changes in v2: - Don't drop unused test helpers, mark them as __attribute__((unused)) - Make some function in nolibc-test static - Also handle -W and -Wextra - Link to v1: https://lore.kernel.org/r/20230731-nolibc-warnings-v1-0-74973d2a52d7@weissschuh.net --- Thomas Weißschuh (14): tools/nolibc: drop unused variables tools/nolibc: fix return type of getpagesize() tools/nolibc: setvbuf: avoid unused parameter warnings tools/nolibc: sys: avoid implicit sign cast tools/nolibc: stdint: use int for size_t on 32bit selftests/nolibc: drop unused variables selftests/nolibc: mark test helpers as potentially unused selftests/nolibc: make functions static if possible selftests/nolibc: avoid unused parameter warnings selftests/nolibc: avoid sign-compare warnings selftests/nolibc: use correct return type for read() and write() selftests/nolibc: prevent out of bounds access in expect_vfprintf selftests/nolibc: don't strip nolibc-test selftests/nolibc: enable compiler warnings tools/include/nolibc/stdint.h | 4 + tools/include/nolibc/stdio.h | 5 +- tools/include/nolibc/sys.h | 7 +- tools/testing/selftests/nolibc/Makefile | 4 +- tools/testing/selftests/nolibc/nolibc-test.c | 111 ++++++++++++++++----------- 5 files changed, 80 insertions(+), 51 deletions(-) --- base-commit: bc87f9562af7b2b4cb07dcaceccfafcf05edaff8 change-id: 20230731-nolibc-warnings-c6e47284ac03 Best regards, -- Thomas Weißschuh