From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4O87F9El6GOGdQEAbAwnHQ (envelope-from ) for ; Sun, 12 Feb 2023 00:33:37 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id CEM0F9El6GO02gAAauVa8A (envelope-from ) for ; Sun, 12 Feb 2023 00:33:37 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C664E2B9FA for ; Sun, 12 Feb 2023 00:33:36 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQzMe-0006lD-Vn; Sat, 11 Feb 2023 18:33:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQzMc-0006kb-1z; Sat, 11 Feb 2023 18:33:02 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQzMa-0004Po-Kn; Sat, 11 Feb 2023 18:33:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=6wwAtNkzHOsGEUZCxz9Rptp1wyBSj24symbXhblQHkU=; b=LjSl1SCqy/gE/9AFEXUg Ap4ENSQSJeS2ue99QNyzxN4XiYAEYU9A+8X673NVGwjDr4UJrDgeuB298KK+dpG1HR3j9KMzgul9v +9S7D8HHSofUx3KNz5WDT24bGTKFO9DoPLTr769QfszuToOAr3GIiC8P8Kv2QhaluTkyEZOcp5S3j QMfK0OIDwCY+/NKWNhyjZF4NJeOaFtT46t1dFgH7xFy+cMPzF/EiecH4jpgzCVgsW8e9AM1oKTuNj OxN9ZQbKljqMzFoXNO88thw93m4+CHISh7uRBh22yt+m/QJxUaFVfV0g2oF8UcfLXVjanwWpEGhR4 3sKg9omaH6a1lA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pQzMZ-0001E1-Vj; Sat, 11 Feb 2023 18:33:00 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guile-devel@gnu.org Cc: guix-devel@gnu.org, =?UTF-8?q?Ludovic=20Court=C3=A8s?= Subject: [PATCH 0/3] Add '-Wunused-module' Date: Sun, 12 Feb 2023 00:32:31 +0100 Message-Id: <20230211233234.14425-1-ludo@gnu.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230203181126.5ee4003c@tachikoma.lepiller.eu> References: <20230203181126.5ee4003c@tachikoma.lepiller.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676158417; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=6wwAtNkzHOsGEUZCxz9Rptp1wyBSj24symbXhblQHkU=; b=Kwuusnr7pMg76Zv8EkWwf2shT6mbpaKVGkpd8Y6fgzF941ZSaXqF+wuzE2iNIomni7VkZV iTWrQsVQbgzGK9CRF4QTIfOcJ/ThX0tgX9ADMPKpnGbpoGBw4LQbhRHm9yDfVOsxfrqRL4 gXGUhY8Fz7wfmEQhgz7LOJilZbaUisR+oQ5usPxUOgh9HEfRJmvqxZcN7gyj6BEwCOtb8r ZJxwUE7Qj5s2+LKfMTpltqEyorOnoz4CvOmxmZ9rKRgxRSL4O+btovh8nsA5EI4TA1PhUB 0i+QBvxeBftbbTbvjGpX7Twy9zVIvDdyNlFbjcX48h/sNvYSoqIfre152Qoi7g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=LjSl1SCq; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676158417; a=rsa-sha256; cv=none; b=Y/5zpZCERipgnAZaRO4fmKa7zm0YYyVVues+tRVxX0o7ovMSZcOE+EYLi3EbRkWb137JO+ 3GxAoGI7SL5EovfnqmGuwrHD5QoINuVgtcpnU85g+Zi0R6CWliwgHWaV/tihOzVjfInZ4k DBfsVhm7uI0OhQHXwd2uZjl8A8v69vfx91e/a7wfzB1PRB6oeHp/1InhaDJ1+hbi/uRpv6 /nKIPFFge0/vPON5K1OV4Ww8p1Lqt/om28vzkpxODDfLQT0i2vF0s+inVOWJCSlnt37TBd FzNegUmm9YnJBO9BlNIhdzHu+erVcWnCZUpwigdm5NWH1/bQRVHPKI6h0BXLYw== X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -9.16 X-Spam-Score: -9.16 X-Migadu-Queue-Id: C664E2B9FA Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=LjSl1SCq; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org X-TUID: 1kKKBalC3ZbW Hello Guilers! Following a discussion started at the Guix Days and continued online¹, it seems we could benefit from a compiler warning for unused modules, and this is what this patch does. The new ‘-Wunused-module’ warning is enabled at ‘-W2’ only. The main reason for not enabling it at ‘-W1’ is that in the case of modules used at macro-expansion time only, such as (srfi srfi-26), it cannot determine whether a module is definitely unused. In this case, the compiler reports the module as “possibly unused”, and it is up to the programmer to check that claim. Currently we cannot do any better because warnings operate at the tree-il, after macro expansion, and there’s nothing indicating whether a piece of code results from macro expansion. There’s also the rare case of modules imported for their side effects, not for their bindings, and that should be kept even if seemingly “unused”. One example might be the use of (rnrs bytevectors) in (rnrs io ports). But again, that’s super unusual. Anyway, it’s pretty useful already and has allowed me to trim imports in Guile modules. Thoughts? Ludo’. ¹ https://lists.gnu.org/archive/html/guix-devel/2023-02/msg00028.html Ludovic Courtès (3): Add -Wunused-module. Add 'record-case' to '.dir-locals.el'. Remove unnecessary module imports. .dir-locals.el | 1 + NEWS | 17 +++ module/ice-9/copy-tree.scm | 1 - module/ice-9/eval-string.scm | 1 - module/ice-9/getopt-long.scm | 1 - module/ice-9/poll.scm | 1 - module/ice-9/popen.scm | 1 - module/ice-9/sandbox.scm | 1 - module/ice-9/threads.scm | 1 - module/language/tree-il/analyze.scm | 138 +++++++++++++++++++++++- module/language/tree-il/fix-letrec.scm | 4 - module/sxml/apply-templates.scm | 2 - module/sxml/simple.scm | 1 - module/system/base/message.scm | 11 +- module/system/base/types.scm | 1 - module/system/repl/command.scm | 3 - module/system/repl/common.scm | 2 - module/system/repl/coop-server.scm | 1 - module/system/repl/debug.scm | 6 -- module/system/repl/error-handling.scm | 1 - module/system/repl/repl.scm | 4 - module/system/repl/server.scm | 1 - module/system/vm/assembler.scm | 2 - module/system/vm/disassembler.scm | 2 - module/system/vm/dwarf.scm | 2 - module/system/vm/elf.scm | 2 - module/system/vm/frame.scm | 2 - module/system/vm/inspect.scm | 5 - module/system/vm/linker.scm | 2 - module/system/vm/program.scm | 1 - module/system/vm/trace.scm | 3 - module/system/vm/trap-state.scm | 1 - module/system/vm/traps.scm | 2 - module/system/xref.scm | 1 - module/texinfo/indexing.scm | 1 - module/texinfo/plain-text.scm | 3 - module/texinfo/reflection.scm | 2 - module/texinfo/string-utils.scm | 2 - module/web/client.scm | 3 - module/web/http.scm | 2 - module/web/request.scm | 1 - module/web/response.scm | 2 - test-suite/tests/tree-il.test | 141 ++++++++++++++++++++++++- 43 files changed, 305 insertions(+), 77 deletions(-) base-commit: 9d339ea1a95c3b2d04a88aa6b116f997349fc4f4 -- 2.39.1