comparison lisp/emacs-lisp/byte-run.el @ 110357:41bf9b6f3b91

Merge changes from emacs-23 branch.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 14 Sep 2010 16:41:53 +0200
parents c87f89486bb7 d2f5496377e6
children 417b1e4d63cd
comparison
equal deleted inserted replaced
110333:c2883613e1b5 110357:41bf9b6f3b91
106 (eval-and-compile 106 (eval-and-compile
107 (put ',name 'byte-optimizer 'byte-compile-inline-expand)))) 107 (put ',name 'byte-optimizer 'byte-compile-inline-expand))))
108 108
109 (defvar advertised-signature-table (make-hash-table :test 'eq :weakness 'key)) 109 (defvar advertised-signature-table (make-hash-table :test 'eq :weakness 'key))
110 110
111 (defun set-advertised-calling-convention (function signature) 111 (defun set-advertised-calling-convention (function signature when)
112 "Set the advertised SIGNATURE of FUNCTION. 112 "Set the advertised SIGNATURE of FUNCTION.
113 This will allow the byte-compiler to warn the programmer when she uses 113 This will allow the byte-compiler to warn the programmer when she uses
114 an obsolete calling convention." 114 an obsolete calling convention. WHEN specifies since when the calling
115 convention was modified."
115 (puthash (indirect-function function) signature 116 (puthash (indirect-function function) signature
116 advertised-signature-table)) 117 advertised-signature-table))
117 118
118 (defun make-obsolete (obsolete-name current-name &optional when) 119 (defun make-obsolete (obsolete-name current-name &optional when)
119 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. 120 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
130 (put obsolete-name 'byte-obsolete-info 131 (put obsolete-name 'byte-obsolete-info
131 (list (purecopy current-name) handler (purecopy when)))) 132 (list (purecopy current-name) handler (purecopy when))))
132 obsolete-name) 133 obsolete-name)
133 (set-advertised-calling-convention 134 (set-advertised-calling-convention
134 ;; New code should always provide the `when' argument. 135 ;; New code should always provide the `when' argument.
135 'make-obsolete '(obsolete-name current-name when)) 136 'make-obsolete '(obsolete-name current-name when) "23.1")
136 137
137 (defmacro define-obsolete-function-alias (obsolete-name current-name 138 (defmacro define-obsolete-function-alias (obsolete-name current-name
138 &optional when docstring) 139 &optional when docstring)
139 "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete. 140 "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete.
140 141
151 (defalias ,obsolete-name ,current-name ,docstring) 152 (defalias ,obsolete-name ,current-name ,docstring)
152 (make-obsolete ,obsolete-name ,current-name ,when))) 153 (make-obsolete ,obsolete-name ,current-name ,when)))
153 (set-advertised-calling-convention 154 (set-advertised-calling-convention
154 ;; New code should always provide the `when' argument. 155 ;; New code should always provide the `when' argument.
155 'define-obsolete-function-alias 156 'define-obsolete-function-alias
156 '(obsolete-name current-name when &optional docstring)) 157 '(obsolete-name current-name when &optional docstring) "23.1")
157 158
158 (defun make-obsolete-variable (obsolete-name current-name &optional when) 159 (defun make-obsolete-variable (obsolete-name current-name &optional when)
159 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. 160 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
160 The warning will say that CURRENT-NAME should be used instead. 161 The warning will say that CURRENT-NAME should be used instead.
161 If CURRENT-NAME is a string, that is the `use instead' message. 162 If CURRENT-NAME is a string, that is the `use instead' message.
173 (purecopy current-name) 174 (purecopy current-name)
174 current-name) (purecopy when))) 175 current-name) (purecopy when)))
175 obsolete-name) 176 obsolete-name)
176 (set-advertised-calling-convention 177 (set-advertised-calling-convention
177 ;; New code should always provide the `when' argument. 178 ;; New code should always provide the `when' argument.
178 'make-obsolete-variable '(obsolete-name current-name when)) 179 'make-obsolete-variable '(obsolete-name current-name when) "23.1")
179 180
180 (defmacro define-obsolete-variable-alias (obsolete-name current-name 181 (defmacro define-obsolete-variable-alias (obsolete-name current-name
181 &optional when docstring) 182 &optional when docstring)
182 "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. 183 "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete.
183 This uses `defvaralias' and `make-obsolete-variable' (which see). 184 This uses `defvaralias' and `make-obsolete-variable' (which see).
208 (put ,current-name prop (get ,obsolete-name prop)))) 209 (put ,current-name prop (get ,obsolete-name prop))))
209 (make-obsolete-variable ,obsolete-name ,current-name ,when))) 210 (make-obsolete-variable ,obsolete-name ,current-name ,when)))
210 (set-advertised-calling-convention 211 (set-advertised-calling-convention
211 ;; New code should always provide the `when' argument. 212 ;; New code should always provide the `when' argument.
212 'define-obsolete-variable-alias 213 'define-obsolete-variable-alias
213 '(obsolete-name current-name when &optional docstring)) 214 '(obsolete-name current-name when &optional docstring) "23.1")
214 215
215 ;; FIXME This is only defined in this file because the variable- and 216 ;; FIXME This is only defined in this file because the variable- and
216 ;; function- versions are too. Unlike those two, this one is not used 217 ;; function- versions are too. Unlike those two, this one is not used
217 ;; by the byte-compiler (would be nice if it could warn about obsolete 218 ;; by the byte-compiler (would be nice if it could warn about obsolete
218 ;; faces, but it doesn't really do anything special with faces). 219 ;; faces, but it doesn't really do anything special with faces).