comparison lisp/bytecomp/bytecomp.el @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents 859a2309aef8
children 131b0175ea99
comparison
equal deleted inserted replaced
21:b88636d63495 22:8fc7fe29b841
101 ;;; match the lambda's definition) 101 ;;; match the lambda's definition)
102 ;;; 'redefine (function cell redefined from 102 ;;; 'redefine (function cell redefined from
103 ;;; a macro to a lambda or vice versa, 103 ;;; a macro to a lambda or vice versa,
104 ;;; or redefined to take other args) 104 ;;; or redefined to take other args)
105 ;;; 'obsolete (obsolete variables and functions) 105 ;;; 'obsolete (obsolete variables and functions)
106 ;;; 'pedantic (references to Emacs-compatible
107 ;;; symbols)
106 ;;; (RMS calls the following option byte-compile-compatibility but 108 ;;; (RMS calls the following option byte-compile-compatibility but
107 ;;; our name is better) 109 ;;; our name is better)
108 ;;; byte-compile-emacs18-compatibility Whether the compiler should 110 ;;; byte-compile-emacs18-compatibility Whether the compiler should
109 ;;; generate .elc files which can be loaded into 111 ;;; generate .elc files which can be loaded into
110 ;;; generic emacs 18. 112 ;;; generic emacs 18.
351 unresolved calls to unknown functions. 353 unresolved calls to unknown functions.
352 callargs lambda calls with args that don't match the definition. 354 callargs lambda calls with args that don't match the definition.
353 redefine function cell redefined from a macro to a lambda or vice 355 redefine function cell redefined from a macro to a lambda or vice
354 versa, or redefined to take a different number of arguments. 356 versa, or redefined to take a different number of arguments.
355 obsolete use of an obsolete function or variable. 357 obsolete use of an obsolete function or variable.
358 pedantic warn of use of compatible symbols.
356 359
357 The default set is specified by `byte-compile-default-warnings' and 360 The default set is specified by `byte-compile-default-warnings' and
358 normally encompasses all possible warnings. 361 normally encompasses all possible warnings.
359 362
360 See also the macro `byte-compiler-options'.") 363 See also the macro `byte-compiler-options'.")
945 ;;; Used by make-obsolete. 948 ;;; Used by make-obsolete.
946 (defun byte-compile-obsolete (form) 949 (defun byte-compile-obsolete (form)
947 (let ((new (get (car form) 'byte-obsolete-info))) 950 (let ((new (get (car form) 'byte-obsolete-info)))
948 (if (memq 'obsolete byte-compile-warnings) 951 (if (memq 'obsolete byte-compile-warnings)
949 (byte-compile-warn "%s is an obsolete function; %s" (car form) 952 (byte-compile-warn "%s is an obsolete function; %s" (car form)
953 (if (stringp (car new))
954 (car new)
955 (format "use %s instead." (car new)))))
956 (funcall (or (cdr new) 'byte-compile-normal-call) form)))
957
958 ;;; Used by make-obsolete.
959 (defun byte-compile-compatible (form)
960 (let ((new (get (car form) 'byte-compatible-info)))
961 (if (memq 'pedantic byte-compile-warnings)
962 (byte-compile-warn "%s is provided for compatibility; %s" (car form)
950 (if (stringp (car new)) 963 (if (stringp (car new))
951 (car new) 964 (car new)
952 (format "use %s instead." (car new))))) 965 (format "use %s instead." (car new)))))
953 (funcall (or (cdr new) 'byte-compile-normal-call) form))) 966 (funcall (or (cdr new) 'byte-compile-normal-call) form)))
954 967
2581 (let ((ob (get var 'byte-obsolete-variable))) 2594 (let ((ob (get var 'byte-obsolete-variable)))
2582 (byte-compile-warn "%s is an obsolete variable; %s" var 2595 (byte-compile-warn "%s is an obsolete variable; %s" var
2583 (if (stringp ob) 2596 (if (stringp ob)
2584 ob 2597 ob
2585 (format "use %s instead." ob))))) 2598 (format "use %s instead." ob)))))
2599 (if (and (get var 'byte-compatible-variable)
2600 (memq 'pedantic byte-compile-warnings))
2601 (let ((ob (get var 'byte-compatible-variable)))
2602 (byte-compile-warn "%s is provided for compatibility; %s" var
2603 (if (stringp ob)
2604 ob
2605 (format "use %s instead." ob)))))
2586 (if (memq 'free-vars byte-compile-warnings) 2606 (if (memq 'free-vars byte-compile-warnings)
2587 (if (eq base-op 'byte-varbind) 2607 (if (eq base-op 'byte-varbind)
2588 (setq byte-compile-bound-variables 2608 (setq byte-compile-bound-variables
2589 (cons (cons var (or varbind-flags 0)) 2609 (cons (cons var (or varbind-flags 0))
2590 byte-compile-bound-variables)) 2610 byte-compile-bound-variables))