From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#47031: False positives for =?UTF-8?Q?=E2=80=98-Wunbound-variable=E2=80=99?= in 3.0.5 Date: Sat, 01 May 2021 22:34:32 +0200 Message-ID: <878s4y6vmv.fsf@gnu.org> References: <87im606kes.fsf@inria.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38609"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) To: 47031@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat May 01 22:35:58 2021 Return-path: Envelope-to: guile-bugs@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 1lcwLG-0009x9-5j for guile-bugs@m.gmane-mx.org; Sat, 01 May 2021 22:35:58 +0200 Original-Received: from localhost ([::1]:43318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcwLF-0008HR-8T for guile-bugs@m.gmane-mx.org; Sat, 01 May 2021 16:35:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcwKM-0007id-QT for bug-guile@gnu.org; Sat, 01 May 2021 16:35:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54956) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcwKM-0002eo-Hd for bug-guile@gnu.org; Sat, 01 May 2021 16:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lcwKM-0005Kt-91 for bug-guile@gnu.org; Sat, 01 May 2021 16:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 01 May 2021 20:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47031 X-GNU-PR-Package: guile Original-Received: via spool by 47031-submit@debbugs.gnu.org id=B47031.161990128220501 (code B ref 47031); Sat, 01 May 2021 20:35:02 +0000 Original-Received: (at 47031) by debbugs.gnu.org; 1 May 2021 20:34:42 +0000 Original-Received: from localhost ([127.0.0.1]:38268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcwK1-0005Kb-Th for submit@debbugs.gnu.org; Sat, 01 May 2021 16:34:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcwK0-0005KV-JI for 47031@debbugs.gnu.org; Sat, 01 May 2021 16:34:40 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49607) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcwJv-0002NN-De for 47031@debbugs.gnu.org; Sat, 01 May 2021 16:34:35 -0400 Original-Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45180 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lcwJu-0007ZR-6Z for 47031@debbugs.gnu.org; Sat, 01 May 2021 16:34:34 -0400 In-Reply-To: <87im606kes.fsf@inria.fr> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Tue, 09 Mar 2021 23:18:19 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10025 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! Ludovic Court=C3=A8s skribis: > $ cat /tmp/unbound.scm > (use-modules (srfi srfi-35)) > > (condition (&message (message "oh no!")) > (&serious)) > $ guild compile -Wunbound-variable /tmp/unbound.scm > /tmp/unbound.scm:3:0: warning: possibly unbound variable `make-compound-c= ondition' The problem was that =E2=80=98make-compound-condition=E2=80=99 is re-export= ed from (srfi srfi-35) and this particular case was not handled. The attached patch fixes it. Let me know what you think! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/module/language/tree-il/analyze.scm b/module/language/tree-il/analyze.scm index 766568f38..4b53e426f 100644 --- a/module/language/tree-il/analyze.scm +++ b/module/language/tree-il/analyze.scm @@ -510,6 +510,11 @@ given `tree-il' element." ;; The variable is an import. At the time of use, the ;; name is bound to the import. 'import) + ((and=> (module-public-interface mod) + (lambda (interface) + (module-variable interface name))) + ;; The variable is re-exported from module. + 'import) (else ;; Variable unbound in the module. 'unbound)))))) diff --git a/test-suite/tests/tree-il.test b/test-suite/tests/tree-il.test index 217a1000f..262c2454d 100644 --- a/test-suite/tests/tree-il.test +++ b/test-suite/tests/tree-il.test @@ -557,6 +557,19 @@ #:env m #:opts %opts-w-unbound)))))))) + (pass-if "macro-inserted binding" + (null? (call-with-warnings + (lambda () + (compile '(begin + (use-modules (srfi srfi-35)) + + ;; This 'condition' form expands to a + ;; 'make-compound-condition' call, which is + ;; re-exported from (ice-9 exceptions). + (condition (&error) + (&message (message "oh!")))) + #:opts %opts-w-unbound))))) + (with-test-prefix "use-before-definition" (define-syntax-rule (pass-if-warnings expr pat test) (pass-if 'expr --=-=-=--