From e7cdbc1d1d46b365ec3a7f5eaa0c14f60119014e Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 6 Jul 2021 22:01:55 +0200 Subject: [PATCH] Make previous empty-body warning disabling more robust * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): `byte-compile-warning-enabled-p' may not be defined here. --- lisp/emacs-lisp/macroexp.el | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 11387df2147..f4bab9c3456 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -318,18 +318,20 @@ Assumes the caller has bound `macroexpand-all-environment'." (`(,(or 'function 'quote) . ,_) form) (`(,(and fun (or 'let 'let*)) . ,(or `(,bindings . ,body) pcase--dontcare)) - (macroexp--cons fun - (macroexp--cons - (macroexp--all-clauses bindings 1) - (if (null body) - (macroexp-unprogn - (macroexp-warn-and-return - (and (byte-compile-warning-enabled-p t) - (format "Empty %s body" fun)) - nil t)) - (macroexp--all-forms body)) - (cdr form)) - form)) + (macroexp--cons + fun + (macroexp--cons + (macroexp--all-clauses bindings 1) + (if (null body) + (macroexp-unprogn + (macroexp-warn-and-return + (and (or (not (fboundp 'byte-compile-warning-enabled-p)) + (byte-compile-warning-enabled-p t)) + (format "Empty %s body" fun)) + nil t)) + (macroexp--all-forms body)) + (cdr form)) + form)) (`(,(and fun `(lambda . ,_)) . ,args) ;; Embedded lambda in function position. ;; If the byte-optimizer is loaded, try to unfold this, -- 2.39.2