diff options
| author | Richard M. Stallman | 2002-07-24 03:58:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-07-24 03:58:02 +0000 |
| commit | 95c997fa7f03b25717db583709d5a52893d7ccc5 (patch) | |
| tree | d32b40a162622067aa6ca9b87f456837f41839da | |
| parent | 3903a6c75b75618884d1d2eb0d8389f916e13eac (diff) | |
| download | emacs-95c997fa7f03b25717db583709d5a52893d7ccc5.tar.gz emacs-95c997fa7f03b25717db583709d5a52893d7ccc5.zip | |
(byte-compile-cl-functions): New variable.
(byte-compile-cl-warn): Use that variable.
(byte-compile-find-cl-functions): New function.
(displaying-byte-compile-warnings):
Call byte-compile-find-cl-functions.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 1bebfd4a9bf..a8cc1400fdb 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | ;;; This version incorporates changes up to version 2.10 of the | 11 | ;;; This version incorporates changes up to version 2.10 of the |
| 12 | ;;; Zawinski-Furuseth compiler. | 12 | ;;; Zawinski-Furuseth compiler. |
| 13 | (defconst byte-compile-version "$Revision: 2.102 $") | 13 | (defconst byte-compile-version "$Revision: 2.106 $") |
| 14 | 14 | ||
| 15 | ;; This file is part of GNU Emacs. | 15 | ;; This file is part of GNU Emacs. |
| 16 | 16 | ||
| @@ -957,6 +957,7 @@ Each function's symbol gets marked with the `byte-compile-noruntime' property." | |||
| 957 | ;; Also log the current function and file if not already done. | 957 | ;; Also log the current function and file if not already done. |
| 958 | (defun byte-compile-log-warning (string &optional fill level) | 958 | (defun byte-compile-log-warning (string &optional fill level) |
| 959 | (let ((warning-prefix-function 'byte-compile-warning-prefix) | 959 | (let ((warning-prefix-function 'byte-compile-warning-prefix) |
| 960 | (warning-group-format "") | ||
| 960 | (warning-fill-prefix (if fill " "))) | 961 | (warning-fill-prefix (if fill " "))) |
| 961 | (display-warning 'bytecomp string level "*Compile-Log*"))) | 962 | (display-warning 'bytecomp string level "*Compile-Log*"))) |
| 962 | 963 | ||
| @@ -1201,23 +1202,39 @@ Each function's symbol gets marked with the `byte-compile-noruntime' property." | |||
| 1201 | (delq calls byte-compile-unresolved-functions))))) | 1202 | (delq calls byte-compile-unresolved-functions))))) |
| 1202 | ))) | 1203 | ))) |
| 1203 | 1204 | ||
| 1205 | (defvar byte-compile-cl-functions nil | ||
| 1206 | "List of functions defined in CL.") | ||
| 1207 | |||
| 1208 | (defun byte-compile-find-cl-functions () | ||
| 1209 | (unless byte-compile-cl-functions | ||
| 1210 | (dolist (elt load-history) | ||
| 1211 | (when (string-match "^cl\\>" (car elt)) | ||
| 1212 | (setq byte-compile-cl-functions | ||
| 1213 | (append byte-compile-cl-functions | ||
| 1214 | (cdr elt))))) | ||
| 1215 | (let ((tail byte-compile-cl-functions)) | ||
| 1216 | (while tail | ||
| 1217 | (if (and (consp (car tail)) | ||
| 1218 | (eq (car (car tail)) 'autoload)) | ||
| 1219 | (setcar tail (cdr (car tail)))) | ||
| 1220 | (setq tail (cdr tail)))))) | ||
| 1221 | |||
| 1204 | (defun byte-compile-cl-warn (form) | 1222 | (defun byte-compile-cl-warn (form) |
| 1205 | "Warn if FORM is a call of a function from the CL package." | 1223 | "Warn if FORM is a call of a function from the CL package." |
| 1206 | (let* ((func (car-safe form)) | 1224 | (let ((func (car-safe form))) |
| 1207 | (library | 1225 | (if (and byte-compile-cl-functions |
| 1208 | (if func | 1226 | (memq func byte-compile-cl-functions) |
| 1209 | (cond ((eq (car-safe func) 'autoload) | ||
| 1210 | (nth 1 func)) | ||
| 1211 | ((symbol-file func)))))) | ||
| 1212 | (if (and library | ||
| 1213 | (string-match "^cl\\>" library) | ||
| 1214 | ;; Aliases which won't have been expended at this point. | 1227 | ;; Aliases which won't have been expended at this point. |
| 1215 | ;; These aren't all aliases of subrs, so not trivial to | 1228 | ;; These aren't all aliases of subrs, so not trivial to |
| 1216 | ;; avoid hardwiring the list. | 1229 | ;; avoid hardwiring the list. |
| 1217 | (not (memq func | 1230 | (not (memq func |
| 1218 | '(cl-block-wrapper cl-block-throw | 1231 | '(cl-block-wrapper cl-block-throw |
| 1219 | multiple-value-call nth-value | 1232 | multiple-value-call nth-value |
| 1220 | copy-seq first second rest endp cl-member)))) | 1233 | copy-seq first second rest endp cl-member |
| 1234 | ;; This is sometimes defined in CL | ||
| 1235 | ;; but that redefines a standard function, | ||
| 1236 | ;; so don't warn about it. | ||
| 1237 | macroexpand)))) | ||
| 1221 | (byte-compile-warn "Function `%s' from cl package called at runtime" | 1238 | (byte-compile-warn "Function `%s' from cl package called at runtime" |
| 1222 | func))) | 1239 | func))) |
| 1223 | form) | 1240 | form) |
| @@ -1317,6 +1334,7 @@ Each function's symbol gets marked with the `byte-compile-noruntime' property." | |||
| 1317 | `(let (warning-series) | 1334 | `(let (warning-series) |
| 1318 | ;; Log the file name. Record position of that text. | 1335 | ;; Log the file name. Record position of that text. |
| 1319 | (setq warning-series (byte-compile-log-file)) | 1336 | (setq warning-series (byte-compile-log-file)) |
| 1337 | (byte-compile-find-cl-functions) | ||
| 1320 | (let ((--displaying-byte-compile-warnings-fn (lambda () | 1338 | (let ((--displaying-byte-compile-warnings-fn (lambda () |
| 1321 | ,@body))) | 1339 | ,@body))) |
| 1322 | (if byte-compile-debug | 1340 | (if byte-compile-debug |