Archived
1
0
Fork 0

records: Do not inline throws for ABI mismatches.

* guix/records.scm (record-abi-mismatch-error): New procedure.
(abi-check): Use it.

Change-Id: I49936599716e117b8fbf26fb9d8f462bbbb8e88b
This commit is contained in:
Ludovic Courtès 2024-04-08 21:47:29 +02:00
parent 9e184d5e54
commit 2f93e1682a
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012-2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -61,6 +61,11 @@
(string-append "% " (symbol->string type-name) (string-append "% " (symbol->string type-name)
" abi-cookie"))))) " abi-cookie")))))
(define (record-abi-mismatch-error type)
(throw 'record-abi-mismatch-error 'abi-check
"~a: record ABI mismatch; recompilation needed"
(list type) '()))
(define (abi-check type cookie) (define (abi-check type cookie)
"Return syntax that checks that the current \"application binary "Return syntax that checks that the current \"application binary
interface\" (ABI) for TYPE is equal to COOKIE." interface\" (ABI) for TYPE is equal to COOKIE."
@ -68,9 +73,7 @@ interface\" (ABI) for TYPE is equal to COOKIE."
#`(unless (eq? current-abi #,cookie) #`(unless (eq? current-abi #,cookie)
;; The source file where this exception is thrown must be ;; The source file where this exception is thrown must be
;; recompiled. ;; recompiled.
(throw 'record-abi-mismatch-error 'abi-check (record-abi-mismatch-error #,type))))
"~a: record ABI mismatch; recompilation needed"
(list #,type) '()))))
(define* (report-invalid-field-specifier name bindings (define* (report-invalid-field-specifier name bindings
#:optional parent-form) #:optional parent-form)