summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2023-08-24 11:41:15 +0200
committerAndy Wingo <wingo@pobox.com>2023-08-24 11:43:31 +0200
commit19c7969fff223f28cad90e21ae04a0a5852901fc (patch)
tree3721ed555e28decb1e6db60ab3f2a5eb6ebd5126
parent1f70d597dbc38585f0eeb6f5d8ca4ae62ed6ec3a (diff)
downloadguile-19c7969fff223f28cad90e21ae04a0a5852901fc.tar.gz
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.
-rw-r--r--module/ice-9/boot-9.scm7
-rw-r--r--module/srfi/srfi-9.scm9
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))