records: Adjust 'record-abi-mismatch-error' arguments.

Previously, 'display-error' (as used by 'warn-about-load-error', for
instance) would be called with a wrong number of arguments when a
'record-abi-mismatch-error' was caught:

  warning: failed to load '(gnu tests install)':
  Backtrace:
  [...]
  ERROR: In procedure display-error:
  Wrong number of arguments to #<procedure display-error (_ _ _ _ _ _)>

Now you get warnings and error reports as intended:

  warning: failed to load '(gnu tests install)':
  In procedure abi-check: <openssh-configuration>: record ABI mismatch; recompilation needed
  warning: failed to load '(gnu tests ssh)':
  In procedure abi-check: <openssh-configuration>: record ABI mismatch; recompilation needed

* guix/records.scm (print-record-abi-mismatch-error): Remove.
Remove top-level call to 'set-exception-printer!'.
(abi-check): Use arguments as expected by 'display-error'.
This commit is contained in:
Ludovic Courtès 2018-08-29 22:28:06 +02:00
parent caf8a003b3
commit de5cbd4a38
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 5 additions and 12 deletions

View File

@ -52,17 +52,6 @@
((weird _ ...) ;weird! ((weird _ ...) ;weird!
(syntax-violation name "invalid field specifier" #'weird))))) (syntax-violation name "invalid field specifier" #'weird)))))
(define (print-record-abi-mismatch-error port key args
default-printer)
(match args
((rtd . _)
;; The source file where this exception is thrown must be recompiled.
(format port "ERROR: ~a: record ABI mismatch; recompilation needed"
rtd))))
(set-exception-printer! 'record-abi-mismatch-error
print-record-abi-mismatch-error)
(eval-when (expand load eval) (eval-when (expand load eval)
;; The procedures below are needed both at run time and at expansion time. ;; The procedures below are needed both at run time and at expansion time.
@ -81,7 +70,11 @@
interface\" (ABI) for TYPE is equal to COOKIE." interface\" (ABI) for TYPE is equal to COOKIE."
(with-syntax ((current-abi (current-abi-identifier type))) (with-syntax ((current-abi (current-abi-identifier type)))
#`(unless (eq? current-abi #,cookie) #`(unless (eq? current-abi #,cookie)
(throw 'record-abi-mismatch-error #,type))))) ;; The source file where this exception is thrown must be
;; recompiled.
(throw 'record-abi-mismatch-error 'abi-check
"~a: record ABI mismatch; recompilation needed"
'(#,type) '())))))
(define-syntax make-syntactic-constructor (define-syntax make-syntactic-constructor
(syntax-rules () (syntax-rules ()