diff options
author | Philipp Stephani <phst@google.com> | 2016-09-03 20:37:47 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2016-09-11 18:12:33 +0200 |
commit | 7edaa77c5e1c0284aac4ce2dc0254d22ae6e49af (patch) | |
tree | 56c3e91df1ae23425e8eb6d3833ace680fdc868a /lisp/emacs-lisp/bytecomp.el | |
parent | 5fd1f7f931163ddf04f0ba0c362840fc91fba54a (diff) | |
download | emacs-7edaa77c5e1c0284aac4ce2dc0254d22ae6e49af.tar.gz emacs-7edaa77c5e1c0284aac4ce2dc0254d22ae6e49af.tar.bz2 emacs-7edaa77c5e1c0284aac4ce2dc0254d22ae6e49af.zip |
Stop calling ‘byte-compile-log-warning’
For errors, use ‘byte-compile-report-error’ instead so that the error
is registered and causes compilation to fail (Bug#24359).
For warnings, use ‘byte-compile-warn’ instead so that
‘byte-compile-error-on-warn’ is honored (Bug#24360).
* lisp/emacs-lisp/macroexp.el (macroexp--funcall-if-compiled)
(macroexp--warn-and-return): Use ‘byte-compile-warn’ instead of
‘byte-compile-log-warning’.
* lisp/emacs-lisp/bytecomp.el (byte-compile-form, byte-compile-unfold-bcf)
(byte-compile-setq, byte-compile-funcall): Use
‘byte-compile-report-error’ instead of ‘byte-compile-log-warning’.
(byte-compile-log-warning): Convert comment to documentation
string. Explain that the function shouldn’t be called directly.
(byte-compile-report-error): Add optional FILL argument.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv--analyze-function, cconv-analyze-form): Use
‘byte-compile-warn’ instead of ‘byte-compile-log-warning’.
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Use
‘byte-compile-warn’ instead of ‘byte-compile-log-warning’.
* lisp/subr.el (add-to-list): Use ‘byte-compile-report-error’ instead
of ‘byte-compile-log-warning’.
(do-after-load-evaluation): Use ‘byte-compile-warn’ instead of
‘byte-compile-log-warning’.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 175690af3e8..b6bb1d6ab90 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1160,9 +1160,13 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (compilation-forget-errors) pt)))) -;; Log a message STRING in `byte-compile-log-buffer'. -;; Also log the current function and file if not already done. (defun byte-compile-log-warning (string &optional fill level) + "Log a message STRING in `byte-compile-log-buffer'. +Also log the current function and file if not already done. If +FILL is non-nil, set `warning-fill-prefix' to four spaces. LEVEL +is the warning level (`:warning' or `:error'). Do not call this +function directly; use `byte-compile-warn' or +`byte-compile-report-error' instead." (let ((warning-prefix-function 'byte-compile-warning-prefix) (warning-type-format "") (warning-fill-prefix (if fill " "))) @@ -1186,15 +1190,16 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (unless (and funcp (memq symbol byte-compile-not-obsolete-funcs)) (byte-compile-warn "%s" msg))))) -(defun byte-compile-report-error (error-info) +(defun byte-compile-report-error (error-info &optional fill) "Report Lisp error in compilation. ERROR-INFO is the error data, in the form of either (ERROR-SYMBOL . DATA) -or STRING." +or STRING. If FILL is non-nil, set ‘warning-fill-prefix’ to four spaces +when printing the error message." (setq byte-compiler-error-flag t) (byte-compile-log-warning (if (stringp error-info) error-info (error-message-string error-info)) - nil :error)) + fill :error)) ;;; sanity-checking arglists @@ -3025,9 +3030,8 @@ for symbols generated by the byte compiler itself." (pcase (cdr form) (`(',var . ,_) (when (assq var byte-compile-lexical-variables) - (byte-compile-log-warning - (format-message "%s cannot use lexical var `%s'" fn var) - nil :error))))) + (byte-compile-report-error + (format-message "%s cannot use lexical var `%s'" fn var)))))) (when (macroexp--const-symbol-p fn) (byte-compile-warn "`%s' called as a function" fn)) (when (and (byte-compile-warning-enabled-p 'interactive-only) @@ -3044,9 +3048,8 @@ for symbols generated by the byte compiler itself." interactive-only)) (t ".")))) (if (eq (car-safe (symbol-function (car form))) 'macro) - (byte-compile-log-warning - (format "Forgot to expand macro %s in %S" (car form) form) - nil :error)) + (byte-compile-report-error + (format "Forgot to expand macro %s in %S" (car form) form))) (if (and handler ;; Make sure that function exists. (and (functionp handler) @@ -3143,9 +3146,8 @@ for symbols generated by the byte compiler itself." (dotimes (_ (- (/ (1+ fmax2) 2) alen)) (byte-compile-push-constant nil))) ((zerop (logand fmax2 1)) - (byte-compile-log-warning - (format "Too many arguments for inlined function %S" form) - nil :error) + (byte-compile-report-error + (format "Too many arguments for inlined function %S" form)) (byte-compile-discard (- alen (/ fmax2 2)))) (t ;; Turn &rest args into a list. @@ -3755,10 +3757,9 @@ discarding." (len (length args))) (if (= (logand len 1) 1) (progn - (byte-compile-log-warning + (byte-compile-report-error (format-message - "missing value for `%S' at end of setq" (car (last args))) - nil :error) + "missing value for `%S' at end of setq" (car (last args)))) (byte-compile-form `(signal 'wrong-number-of-arguments '(setq ,len)) byte-compile--for-effect)) @@ -4028,8 +4029,8 @@ that suppresses all warnings during execution of BODY." (progn (mapc 'byte-compile-form (cdr form)) (byte-compile-out 'byte-call (length (cdr (cdr form))))) - (byte-compile-log-warning - (format-message "`funcall' called with no arguments") nil :error) + (byte-compile-report-error + (format-message "`funcall' called with no arguments")) (byte-compile-form '(signal 'wrong-number-of-arguments '(funcall 0)) byte-compile--for-effect))) |