wingo pushed a commit to branch main
in repository guile.

commit 19c7969fff223f28cad90e21ae04a0a5852901fc
Author: Andy Wingo <wi...@pobox.com>
AuthorDate: Thu Aug 24 11:41:15 2023 +0200

    define-inlinable marks residualized procedure as maybe-unused
    
    * module/ice-9/boot-9.scm (define-inlinable):
    * module/srfi/srfi-9.scm (define-tagged-inlinable): Add maybe-unused
    declaration.  Also require at least one body expr, otherwise the
    metadata declaration could escape as the proc body.
---
 module/ice-9/boot-9.scm | 7 ++++---
 module/srfi/srfi-9.scm  | 9 +++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 8aef6db75..a5f2eea9b 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -4608,21 +4608,22 @@ when none is available, reading FILE-NAME with READER."
                                     '-procedure)))
 
     (syntax-case x ()
-      ((_ (name formals ...) body ...)
+      ((_ (name formals ...) body0 body ...)
        (identifier? #'name)
        (with-syntax ((proc-name  (make-procedure-name #'name))
                      ((args ...) (generate-temporaries #'(formals ...))))
          #`(begin
              (define (proc-name formals ...)
+               #((maybe-unused))
                (syntax-parameterize ((name (identifier-syntax proc-name)))
-                 body ...))
+                 body0 body ...))
              (define-syntax-parameter name
                (lambda (x)
                  (syntax-case x ()
                    ((_ args ...)
                     #'((syntax-parameterize ((name (identifier-syntax 
proc-name)))
                          (lambda (formals ...)
-                           body ...))
+                           body0 body ...))
                        args ...))
                    ((_ a (... ...))
                     (syntax-violation 'name "Wrong number of arguments" x))
diff --git a/module/srfi/srfi-9.scm b/module/srfi/srfi-9.scm
index 9bb6e6971..1f1f5e4af 100644
--- a/module/srfi/srfi-9.scm
+++ b/module/srfi/srfi-9.scm
@@ -1,6 +1,6 @@
 ;;; srfi-9.scm --- define-record-type
 
-;; Copyright (C) 2001-2002, 2006, 2008-2014, 2018-2019
+;; Copyright (C) 2001-2002, 2006, 2008-2014, 2018-2019, 2023
 ;;   Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
@@ -108,20 +108,21 @@
                                     '-procedure)))
 
     (syntax-case x ()
-      ((_ ((key value) ...) (name formals ...) body ...)
+      ((_ ((key value) ...) (name formals ...) body0 body ...)
        (identifier? #'name)
        (with-syntax ((proc-name  (make-procedure-name #'name))
                      ((args ...) (generate-temporaries #'(formals ...))))
          #`(begin
              (define (proc-name formals ...)
-               body ...)
+               #((maybe-unused))
+               body0 body ...)
              (define-syntax name
                (lambda (x)
                  (syntax-case x (%%on-error key ...)
                    ((_ (%%on-error err) key s) #'(ck s 'value)) ...
                    ((_ args ...)
                     #'((lambda (formals ...)
-                         body ...)
+                         body0 body ...)
                        args ...))
                    ((_ a (... ...))
                     (syntax-violation 'name "Wrong number of arguments" x))

Reply via email to