From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.help Subject: Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'? Date: Fri, 8 Jan 2021 14:31:14 +0100 Message-ID: References: <87o8hzj0hh.fsf@zoho.eu> <20210108110743.GB21347@tuxteam.de> <87pn2fhadb.fsf@zoho.eu> <20210108131343.GC21347@tuxteam.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22800"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 08 14:33:05 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kxrt3-0005mZ-41 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 08 Jan 2021 14:33:05 +0100 Original-Received: from localhost ([::1]:40618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxrt2-0004NK-6R for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 08 Jan 2021 08:33:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxrrX-0003p0-7W for help-gnu-emacs@gnu.org; Fri, 08 Jan 2021 08:31:32 -0500 Original-Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:34228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxrrT-0007II-Ik for help-gnu-emacs@gnu.org; Fri, 08 Jan 2021 08:31:30 -0500 Original-Received: by mail-ot1-x334.google.com with SMTP id a109so9658945otc.1 for ; Fri, 08 Jan 2021 05:31:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fhyGOXnk/1e+2cBVk8LSWZe/YUUTKflM61NA/MGLLoc=; b=CXssO6L6WKWy+Z/t0iVFTmd3fejn5US7TSJh5umH6Ln4Q0V6vTlAnE98MK1poda8YW 57WqLHgt/P3m0cTkbrQDwYhjMOxp9SpyNUNnLGJX5Fo4TnbZWjtr1ADbd1VfiArjK1Hk KVfaRCXeRDr7H2lbHG5Z90FaBiLJ4gtTecyYPE+SNnHZKaAfrHkon8l7uYunhQba7Cms wuPPZtaJA25JEE6hheR4jZ8p+CATJoJ52Lg69EcDt5ZzylvqkP0ZXGHTUWm5Vk2NrDXe ujSYUX25AblL3VjHmPcfuGTbnlHbJFHt0rl6ItupEm3ZuoXs5/4VhFlXvCX9FyKDU2QE F5jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fhyGOXnk/1e+2cBVk8LSWZe/YUUTKflM61NA/MGLLoc=; b=PzXVOLH3/LT7lSPu82fhOHj1tvYIGdMnGjTun0Iy1zt6xMu30F/oPWOfGG/RFiLGl2 66yaVZ7zQWmXUHhfxOBHagTtMHZDmr8BxGYyiN5KyF+NB/kUMCePD8vOq0rWKdYfKnTH 1YN/fDCzlN8YgdGY66Usno9tr9j3AU+YFfb6b2C2xAojDBh5MtZ1JUQKIEn2yRvXP8iR j/HC89HCBmLnvSN7qynOQIpTxcV4g88I4XRbNgP+wrXKKNZytkM2OSU1fY3q1gJlYlY5 iwQmaZm2XzJL7rNhhslrP9Vghx9/et9CXYw++BIuuJ9CyRYs54ZA7gyTcc/TdnhgVdT9 Bhgw== X-Gm-Message-State: AOAM533bue1UbuBfD3IGZMsJgM0wOAlMaGfaHZEzJFTQOW6g+HS8eLnY aejLgfaiAEoAwfRQqxO42ix1XCUFKzysEH77ij9caQ9/YcXZQw== X-Google-Smtp-Source: ABdhPJzz/g1+0SjtfMAwwVTjc6aW/FeH/t+1s1ybG95rCIsxMAtjK6JWwo5SEFE0cZ6IS8Bypt9SBxnRIdefTF6zTY8= X-Received: by 2002:a05:6830:578:: with SMTP id f24mr2464372otc.36.1610112686025; Fri, 08 Jan 2021 05:31:26 -0800 (PST) In-Reply-To: <20210108131343.GC21347@tuxteam.de> Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=p.stephani2@gmail.com; helo=mail-ot1-x334.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127106 Archived-At: Am Fr., 8. Jan. 2021 um 14:14 Uhr schrieb : > Fixing the macro definition is a bit more attractive (e.g. > it could try to decide whether RESULT depends on i and > not generate that let-binding if not), but I can't decide > right now whether that involves the halting problem or not. Certainly not, since that's what the byte compiler is doing. It's just a lexical walk through the code after macroexpansion. (require 'cconv) (let ((env '((VAR nil nil nil nil)))) (cconv-analyze-form (macroexpand-all RESULT-FORM t) env) (cadr (assq VAR env))) Should return t if VAR is used in RESULT-FORM. But then, I don't know whether that's worth it or not. Alternatively, you could add an (ignore VAR) to the macro expansion of the result form so that cconv treats the variable as used.