Mercurial > hg > xemacs-beta
comparison lisp/bytecomp.el @ 4783:e29fcfd8df5f
Eliminate most core code byte-compile warnings.
2009-12-18 Aidan Kehoe <kehoea@parhasard.net>
* alist.el (modify-alist):
* autoload.el (update-autoload-files, autoload-print-form):
* bytecomp.el (batch-byte-compile-1)
(byte-compile-multiple-value-call, byte-compile-funcall)
(byte-compile-insert, byte-compile-concat, byte-compile-list)
(byte-compile-normal-call, byte-compile-flush-pending):
* cl-macs.el (letf):
* cl.el:
* disass.el (disassemble-1):
* easy-mmode.el (easy-mmode-define-syntax):
* faces.el (set-face-parent):
* files.el (cd):
* finder.el (finder-list-matches, finder-list-keywords)
(finder-compile-keywords):
* frame.el (frame-notice-user-settings)
(frame-remove-geometry-props):
* ldap.el (ldap-delete-entries, ldap-modify-entries)
(ldap-add-entries):
* loadhist.el (unload-feature):
* map-ynp.el (map-y-or-n-p):
* menubar-items.el (default-menubar):
* mouse.el (default-mouse-track-next-move-rect)
(default-mouse-track-next-move-rect)
(default-mouse-track-cleanup-hook)
(default-mouse-track-cleanup-extent):
* mule/ethio-util.el (ethio-fidel-to-sera-buffer)
(ethio-modify-vowel):
* obsolete.el:
* package-get.el (package-get-update-all):
* package-ui.el (pui-list-packages)
(pui-install-selected-packages, pui-install-selected-packages):
* select.el (select-make-extent-for-selection)
(dehilight-selection):
* simple.el (clone-buffer):
* term/tvi970.el:
* term/wyse50.el:
* unicode.el:
(load-unicode-tables):
* x-font-menu.el (fc-make-font-menu-entry)
(x-reset-device-font-menus-xft):
* x-misc.el (x-init-specifier-from-resources):
Eliminate byte-compile warnings, with the exception of Stephen's
various non-defined fontconfig functions, as I don't know if he
plans to add them and is keeping the warnings around as a
reminder. The warnings actually eliminated involve i) using mapcar
instead of mapc where the result is discarded and ii) using a
lambda quoted as data in a context where it is unequivocally used
as a function.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Fri, 18 Dec 2009 17:49:43 +0000 |
parents | 1d61580e0cf7 |
children | 6772ce4d982b |
comparison
equal
deleted
inserted
replaced
4782:1523f1d28be1 | 4783:e29fcfd8df5f |
---|---|
2069 | 2069 |
2070 (defun byte-compile-flush-pending () | 2070 (defun byte-compile-flush-pending () |
2071 (if byte-compile-output | 2071 (if byte-compile-output |
2072 (let ((form (byte-compile-out-toplevel t 'file))) | 2072 (let ((form (byte-compile-out-toplevel t 'file))) |
2073 (cond ((eq (car-safe form) 'progn) | 2073 (cond ((eq (car-safe form) 'progn) |
2074 (mapcar 'byte-compile-output-file-form (cdr form))) | 2074 (mapc 'byte-compile-output-file-form (cdr form))) |
2075 (form | 2075 (form |
2076 (byte-compile-output-file-form form))) | 2076 (byte-compile-output-file-form form))) |
2077 (setq byte-compile-constants nil | 2077 (setq byte-compile-constants nil |
2078 byte-compile-variables nil | 2078 byte-compile-variables nil |
2079 byte-compile-depth 0 | 2079 byte-compile-depth 0 |
2860 | 2860 |
2861 (defun byte-compile-normal-call (form) | 2861 (defun byte-compile-normal-call (form) |
2862 (if byte-compile-generate-call-tree | 2862 (if byte-compile-generate-call-tree |
2863 (byte-compile-annotate-call-tree form)) | 2863 (byte-compile-annotate-call-tree form)) |
2864 (byte-compile-push-constant (car form)) | 2864 (byte-compile-push-constant (car form)) |
2865 (mapcar 'byte-compile-form (cdr form)) ; wasteful, but faster. | 2865 (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster. |
2866 (byte-compile-out 'byte-call (length (cdr form)))) | 2866 (byte-compile-out 'byte-call (length (cdr form)))) |
2867 | 2867 |
2868 ;; kludge added to XEmacs to work around the bogosities of a nonlexical lisp. | 2868 ;; kludge added to XEmacs to work around the bogosities of a nonlexical lisp. |
2869 (or (fboundp 'globally-boundp) (fset 'globally-boundp 'boundp)) | 2869 (or (fboundp 'globally-boundp) (fset 'globally-boundp 'boundp)) |
2870 | 2870 |
3390 (nargs (length args))) | 3390 (nargs (length args))) |
3391 (cond | 3391 (cond |
3392 ((= nargs 0) | 3392 ((= nargs 0) |
3393 (byte-compile-constant nil)) | 3393 (byte-compile-constant nil)) |
3394 ((< nargs 5) | 3394 ((< nargs 5) |
3395 (mapcar 'byte-compile-form args) | 3395 (mapc 'byte-compile-form args) |
3396 (byte-compile-out | 3396 (byte-compile-out |
3397 (aref [byte-list1 byte-list2 byte-list3 byte-list4] (1- nargs)) | 3397 (aref [byte-list1 byte-list2 byte-list3 byte-list4] (1- nargs)) |
3398 0)) | 3398 0)) |
3399 ((< nargs 256) | 3399 ((< nargs 256) |
3400 (mapcar 'byte-compile-form args) | 3400 (mapc 'byte-compile-form args) |
3401 (byte-compile-out 'byte-listN nargs)) | 3401 (byte-compile-out 'byte-listN nargs)) |
3402 (t (byte-compile-normal-call form))))) | 3402 (t (byte-compile-normal-call form))))) |
3403 | 3403 |
3404 (defun byte-compile-concat (form) | 3404 (defun byte-compile-concat (form) |
3405 (let* ((args (cdr form)) | 3405 (let* ((args (cdr form)) |
3406 (nargs (length args))) | 3406 (nargs (length args))) |
3407 ;; Concat of one arg is not a no-op if arg is not a string. | 3407 ;; Concat of one arg is not a no-op if arg is not a string. |
3408 (cond | 3408 (cond |
3409 ((memq nargs '(2 3 4)) | 3409 ((memq nargs '(2 3 4)) |
3410 (mapcar 'byte-compile-form args) | 3410 (mapc 'byte-compile-form args) |
3411 (byte-compile-out | 3411 (byte-compile-out |
3412 (aref [byte-concat2 byte-concat3 byte-concat4] (- nargs 2)) | 3412 (aref [byte-concat2 byte-concat3 byte-concat4] (- nargs 2)) |
3413 0)) | 3413 0)) |
3414 ((eq nargs 0) | 3414 ((eq nargs 0) |
3415 (byte-compile-form "")) | 3415 (byte-compile-form "")) |
3416 ((< nargs 256) | 3416 ((< nargs 256) |
3417 (mapcar 'byte-compile-form args) | 3417 (mapc 'byte-compile-form args) |
3418 (byte-compile-out 'byte-concatN nargs)) | 3418 (byte-compile-out 'byte-concatN nargs)) |
3419 ((byte-compile-normal-call form))))) | 3419 ((byte-compile-normal-call form))))) |
3420 | 3420 |
3421 (defun byte-compile-plus (form) | 3421 (defun byte-compile-plus (form) |
3422 (let ((args (cdr form))) | 3422 (let ((args (cdr form))) |
3586 | 3586 |
3587 (defun byte-compile-insert (form) | 3587 (defun byte-compile-insert (form) |
3588 (cond ((null (cdr form)) | 3588 (cond ((null (cdr form)) |
3589 (byte-compile-constant nil)) | 3589 (byte-compile-constant nil)) |
3590 ((<= (length form) 256) | 3590 ((<= (length form) 256) |
3591 (mapcar 'byte-compile-form (cdr form)) | 3591 (mapc 'byte-compile-form (cdr form)) |
3592 (if (cdr (cdr form)) | 3592 (if (cdr (cdr form)) |
3593 (byte-compile-out 'byte-insertN (length (cdr form))) | 3593 (byte-compile-out 'byte-insertN (length (cdr form))) |
3594 (byte-compile-out 'byte-insert 0))) | 3594 (byte-compile-out 'byte-insert 0))) |
3595 ((memq t (mapcar 'consp (cdr (cdr form)))) | 3595 ((memq t (mapcar 'consp (cdr (cdr form)))) |
3596 (byte-compile-normal-call form)) | 3596 (byte-compile-normal-call form)) |
3943 (byte-compile-goto 'byte-goto looptag) | 3943 (byte-compile-goto 'byte-goto looptag) |
3944 (byte-compile-out-tag endtag) | 3944 (byte-compile-out-tag endtag) |
3945 (setq for-effect nil))) | 3945 (setq for-effect nil))) |
3946 | 3946 |
3947 (defun byte-compile-funcall (form) | 3947 (defun byte-compile-funcall (form) |
3948 (mapcar 'byte-compile-form (cdr form)) | 3948 (mapc 'byte-compile-form (cdr form)) |
3949 (byte-compile-out 'byte-call (length (cdr (cdr form))))) | 3949 (byte-compile-out 'byte-call (length (cdr (cdr form))))) |
3950 | 3950 |
3951 | 3951 |
3952 (defun byte-compile-let (form) | 3952 (defun byte-compile-let (form) |
3953 ;; First compute the binding values in the old scope. | 3953 ;; First compute the binding values in the old scope. |
4146 (byte-compile-variable-ref 'byte-varref 'multiple-values-limit) | 4146 (byte-compile-variable-ref 'byte-varref 'multiple-values-limit) |
4147 ;; bind-multiple-value-limits leaves two existing values on the stack, | 4147 ;; bind-multiple-value-limits leaves two existing values on the stack, |
4148 ;; and pushes a new value, the specpdl_depth() at the time it was | 4148 ;; and pushes a new value, the specpdl_depth() at the time it was |
4149 ;; called. | 4149 ;; called. |
4150 (byte-compile-out 'byte-bind-multiple-value-limits 0) | 4150 (byte-compile-out 'byte-bind-multiple-value-limits 0) |
4151 (mapcar 'byte-compile-form (cdr form)) | 4151 (mapc 'byte-compile-form (cdr form)) |
4152 ;; Most of the other code puts this sort of value in the program stream, | 4152 ;; Most of the other code puts this sort of value in the program stream, |
4153 ;; not pushing it on the stack. | 4153 ;; not pushing it on the stack. |
4154 (byte-compile-push-constant (+ 3 (length form))) | 4154 (byte-compile-push-constant (+ 3 (length form))) |
4155 (byte-compile-out 'byte-multiple-value-call (+ 3 (length form))) | 4155 (byte-compile-out 'byte-multiple-value-call (+ 3 (length form))) |
4156 (pushnew '(subrp (symbol-function 'multiple-value-call)) | 4156 (pushnew '(subrp (symbol-function 'multiple-value-call)) |
4578 (princ file) | 4578 (princ file) |
4579 (princ ": ") | 4579 (princ ": ") |
4580 (if (fboundp 'display-error) ; XEmacs 19.8+ | 4580 (if (fboundp 'display-error) ; XEmacs 19.8+ |
4581 (display-error err nil) | 4581 (display-error err nil) |
4582 (princ (or (get (car err) 'error-message) (car err))) | 4582 (princ (or (get (car err) 'error-message) (car err))) |
4583 (mapcar #'(lambda (x) (princ " ") (prin1 x)) (cdr err))) | 4583 (mapc #'(lambda (x) (princ " ") (prin1 x)) (cdr err))) |
4584 (princ "\n") | 4584 (princ "\n") |
4585 nil))) | 4585 nil))) |
4586 | 4586 |
4587 ;;;###autoload | 4587 ;;;###autoload |
4588 (defun batch-byte-recompile-directory-norecurse () | 4588 (defun batch-byte-recompile-directory-norecurse () |