428
|
1 ;;; bytecomp-runtime.el --- byte-compiler support for inlining
|
|
2
|
|
3 ;; Copyright (C) 1992, 1997 Free Software Foundation, Inc.
|
|
4
|
|
5 ;; Author: Jamie Zawinski <jwz@jwz.org>
|
|
6 ;; Author: Hallvard Furuseth <hbf@ulrik.uio.no>
|
|
7 ;; Maintainer: XEmacs Development Team
|
|
8 ;; Keywords: internal, dumped
|
|
9
|
|
10 ;; This file is part of XEmacs.
|
|
11
|
|
12 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
13 ;; under the terms of the GNU General Public License as published by
|
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;; any later version.
|
|
16
|
|
17 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 ;; General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
25 ;; Boston, MA 02111-1307, USA.
|
|
26
|
|
27 ;;; Synched up with: FSF 19.30.
|
|
28
|
|
29 ;;; Commentary:
|
|
30
|
|
31 ;; This file is dumped with XEmacs.
|
|
32
|
|
33 ;; The code in this file should always be loaded, because it defines things
|
|
34 ;; like "defsubst" which should work interpreted as well. The code in
|
|
35 ;; bytecomp.el and byte-optimize.el can be loaded as needed.
|
|
36
|
|
37 ;; interface to selectively inlining functions.
|
|
38 ;; This only happens when source-code optimization is turned on.
|
|
39
|
|
40 ;;; Code:
|
|
41
|
|
42 ;; Redefined in byte-optimize.el.
|
|
43 ;; This is not documented--it's not clear that we should promote it.
|
|
44 (fset 'inline 'progn)
|
|
45 (put 'inline 'lisp-indent-hook 0)
|
|
46
|
|
47
|
|
48 ;;; Interface to inline functions.
|
|
49
|
|
50 ;; FSF comments the next two out, but I see no reason to do so. --ben
|
|
51 (defmacro proclaim-inline (&rest fns)
|
|
52 "Cause the named functions to be open-coded when called from compiled code.
|
|
53 They will only be compiled open-coded when `byte-optimize' is true."
|
|
54 (cons 'eval-and-compile
|
|
55 (apply
|
|
56 'nconc
|
|
57 (mapcar
|
|
58 #'(lambda (x)
|
|
59 `((or (memq (get ',x 'byte-optimizer)
|
|
60 '(nil byte-compile-inline-expand))
|
|
61 (error
|
|
62 "%s already has a byte-optimizer, can't make it inline"
|
|
63 ',x))
|
|
64 (put ',x 'byte-optimizer 'byte-compile-inline-expand)))
|
|
65 fns))))
|
|
66
|
|
67
|
|
68 (defmacro proclaim-notinline (&rest fns)
|
|
69 "Cause the named functions to no longer be open-coded."
|
|
70 (cons 'eval-and-compile
|
|
71 (apply
|
|
72 'nconc
|
|
73 (mapcar
|
|
74 #'(lambda (x)
|
|
75 `((if (eq (get ',x 'byte-optimizer)
|
|
76 'byte-compile-inline-expand)
|
|
77 (put ',x 'byte-optimizer nil))))
|
|
78 fns))))
|
|
79
|
|
80 ;; This has a special byte-hunk-handler in bytecomp.el.
|
|
81 (defmacro defsubst (name arglist &rest body)
|
|
82 "Define an inline function. The syntax is just like that of `defun'."
|
|
83 (or (memq (get name 'byte-optimizer)
|
|
84 '(nil byte-compile-inline-expand))
|
|
85 (error "`%s' is a primitive" name))
|
|
86 (list 'prog1
|
|
87 (cons 'defun (cons name (cons arglist body)))
|
|
88 (list 'proclaim-inline name)))
|
|
89 ; Instead of the above line, FSF has this:
|
|
90 ; (list 'eval-and-compile
|
|
91 ; (list 'put (list 'quote name)
|
|
92 ; ''byte-optimizer ''byte-compile-inline-expand))))
|
|
93
|
|
94 (defun make-obsolete (fn new)
|
|
95 "Make the byte-compiler warn that FUNCTION is obsolete.
|
|
96 The warning will say that NEW should be used instead.
|
|
97 If NEW is a string, that is the `use instead' message."
|
|
98 (interactive "aMake function obsolete: \nxObsoletion replacement: ")
|
|
99 (let ((handler (get fn 'byte-compile)))
|
|
100 (if (eq 'byte-compile-obsolete handler)
|
|
101 (setcar (get fn 'byte-obsolete-info) new)
|
|
102 (put fn 'byte-obsolete-info (cons new handler))
|
|
103 (put fn 'byte-compile 'byte-compile-obsolete)))
|
|
104 fn)
|
|
105
|
|
106 (defun make-obsolete-variable (var new)
|
|
107 "Make the byte-compiler warn that VARIABLE is obsolete,
|
|
108 and NEW should be used instead. If NEW is a string, then that is the
|
|
109 `use instead' message."
|
|
110 (interactive
|
|
111 (list
|
|
112 (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t)))
|
|
113 (if (equal str "") (error ""))
|
|
114 (intern str))
|
|
115 (car (read-from-string (read-string "Obsoletion replacement: ")))))
|
|
116 (put var 'byte-obsolete-variable new)
|
|
117 var)
|
|
118
|
|
119 ;; By overwhelming demand, we separate out truly obsolete symbols from
|
|
120 ;; those that are present for GNU Emacs compatibility.
|
|
121 (defun make-compatible (fn new)
|
|
122 "Make the byte-compiler know that FUNCTION is provided for compatibility.
|
|
123 The warning will say that NEW should be used instead.
|
|
124 If NEW is a string, that is the `use instead' message."
|
|
125 (interactive "aMake function compatible: \nxCompatible replacement: ")
|
|
126 (let ((handler (get fn 'byte-compile)))
|
|
127 (if (eq 'byte-compile-compatible handler)
|
|
128 (setcar (get fn 'byte-compatible-info) new)
|
|
129 (put fn 'byte-compatible-info (cons new handler))
|
|
130 (put fn 'byte-compile 'byte-compile-compatible)))
|
|
131 fn)
|
|
132
|
|
133 (defun make-compatible-variable (var new)
|
|
134 "Make the byte-compiler know that VARIABLE is provided for compatibility.
|
|
135 and NEW should be used instead. If NEW is a string, then that is the
|
|
136 `use instead' message."
|
|
137 (interactive
|
|
138 (list
|
|
139 (let ((str (completing-read "Make variable compatible: "
|
|
140 obarray 'boundp t)))
|
|
141 (if (equal str "") (error ""))
|
|
142 (intern str))
|
|
143 (car (read-from-string (read-string "Compatible replacement: ")))))
|
|
144 (put var 'byte-compatible-variable new)
|
|
145 var)
|
|
146
|
|
147 (put 'dont-compile 'lisp-indent-hook 0)
|
|
148 (defmacro dont-compile (&rest body)
|
|
149 "Like `progn', but the body always runs interpreted (not compiled).
|
|
150 If you think you need this, you're probably making a mistake somewhere."
|
|
151 (list 'eval (list 'quote (if (cdr body) (cons 'progn body) (car body)))))
|
|
152
|
|
153
|
|
154 ;;; interface to evaluating things at compile time and/or load time
|
|
155 ;;; these macro must come after any uses of them in this file, as their
|
|
156 ;;; definition in the file overrides the magic definitions on the
|
|
157 ;;; byte-compile-macro-environment.
|
|
158
|
|
159 (put 'eval-when-compile 'lisp-indent-hook 0)
|
|
160 (defmacro eval-when-compile (&rest body)
|
|
161 "Like `progn', but evaluates the body at compile time.
|
|
162 The result of the body appears to the compiler as a quoted constant."
|
|
163 ;; Not necessary because we have it in b-c-initial-macro-environment
|
|
164 ;; (list 'quote (eval (cons 'progn body)))
|
|
165 (cons 'progn body))
|
|
166
|
|
167 (put 'eval-and-compile 'lisp-indent-hook 0)
|
|
168 (defmacro eval-and-compile (&rest body)
|
|
169 "Like `progn', but evaluates the body at compile time and at load time."
|
|
170 ;; Remember, it's magic.
|
|
171 (cons 'progn body))
|
|
172
|
|
173 ;;; From Emacs 20.
|
|
174 (put 'eval-when-feature 'lisp-indent-hook 1)
|
|
175 (defmacro eval-when-feature (feature &rest body)
|
|
176 "Run the body forms when FEATURE is featurep, be it now or later.
|
|
177 Called (eval-when-feature (FEATURE [. FILENAME]) BODYFORMS...).
|
|
178 If (featurep 'FEATURE), evals now; otherwise adds an elt to
|
|
179 `after-load-alist' (which see), using FEATURE as filename if FILENAME is nil."
|
|
180 (let ((file (or (cdr feature) (symbol-name (car feature)))))
|
|
181 `(let ((bodythunk #'(lambda () ,@body)))
|
|
182 (if (featurep ',(car feature))
|
|
183 (funcall bodythunk)
|
|
184 (setq after-load-alist (cons '(,file . (list 'lambda '() bodythunk))
|
|
185 after-load-alist))))))
|
502
|
186
|
|
187
|
|
188
|
|
189 ;;; Functions to cleanly eliminate warnings about undefined functions
|
|
190 ;;; or variables when the code knows what it's doing. These macros DO
|
|
191 ;;; NOT rely on any byte-compiler changes, and thus can be copied into
|
|
192 ;;; a package and used within it.
|
|
193
|
|
194 ;; NOTE: As a result of the above requirement, the macros rely on
|
|
195 ;; "tricks" to get the warnings suppressed. A cleaner way, of course,
|
|
196 ;; would be to extend the byte compiler to provide a proper interface.
|
|
197
|
|
198 ;; #### Should we require an unquoted symbol rather than a quoted one,
|
|
199 ;; as we currently do? The quoting gets no generality, as `eval' is
|
|
200 ;; called at compile time. But most functions and macros want quoted
|
|
201 ;; arguments, and I find it extremely confusing to deal with cases
|
|
202 ;; such as `throw' requiring a quoted argument but `block' an unquoted
|
|
203 ;; one.
|
|
204
|
|
205 (put 'with-boundp 'lisp-indent-function 1)
|
|
206 (defmacro with-boundp (symbols &rest body)
|
|
207 "Evaluate BODY, but do not issue bytecomp warnings about SYMBOLS undefined.
|
|
208 SYMBOLS can be a symbol or a list of symbols and must be quoted. When
|
|
209 compiling this file, the warning `reference to free variable SYMBOL'
|
|
210 will not occur. This is a clean way to avoid such warnings. See also
|
|
211 `declare-boundp' and `if-boundp'."
|
|
212 (setq symbols (eval symbols))
|
|
213 (unless (consp symbols)
|
|
214 (setq symbols (list symbols)))
|
|
215 `(progn
|
|
216 (declare (special ,@symbols))
|
|
217 ,@body))
|
|
218
|
|
219 (put 'if-boundp 'lisp-indent-function 2)
|
|
220 (defmacro if-boundp (symbol then &rest else)
|
|
221 "Equivalent to (if (boundp SYMBOL) THEN ELSE) but handles bytecomp warnings.
|
|
222 When compiling this file, the warning `reference to free variable SYMBOL'
|
|
223 will not occur. This is a clean way to avoid such warnings. See also
|
|
224 `with-boundp' and `declare-boundp'."
|
|
225 `(with-boundp ,symbol
|
|
226 (if (boundp ,symbol) ,then ,@else)))
|
|
227
|
|
228 (defmacro declare-boundp (symbol)
|
|
229 "Evaluate SYMBOL without bytecomp warnings about the symbol.
|
|
230 Sample usage is
|
|
231
|
|
232 (declare-boundp gpm-minor-mode)
|
|
233
|
|
234 which is equivalent to
|
|
235
|
|
236 (with-fboundp 'gpm-minor-mode
|
|
237 gpm-minor-mode)"
|
|
238 `(with-boundp ',symbol ,symbol))
|
|
239
|
|
240 (defmacro globally-declare-boundp (symbol)
|
|
241 "Declare that all free uses of SYMBOL in this file are valid.
|
|
242 SYMBOL can also be a list of symbols. SYMBOL must be quoted.
|
|
243
|
|
244 When compiling this file, the warning `reference to free variable
|
|
245 SYMBOL' will not occur regardless of where calls to SYMBOL occur in
|
|
246 the file.
|
|
247
|
|
248 In general, you should *NOT* use this; use `declare-boundp',
|
|
249 `if-boundp', or `with-boundp' to wrap individual uses, as necessary.
|
|
250 That way, you're more likely to remember to put in the explicit checks
|
|
251 for the variable's existence that are usually necessary. However,
|
|
252 `globally-declare-boundp' is better in some circumstances, such as
|
|
253 when writing an ELisp package that makes integral use of
|
|
254 optionally-compiled-in functionality (typically, an interface onto a
|
|
255 system library) and checks for the existence of the functionality at
|
|
256 some entry point to the package. See `globally-declare-fboundp' for
|
|
257 more information."
|
|
258 (setq symbol (eval symbol))
|
|
259 (if (not (consp symbol))
|
|
260 (setq symbol (list symbol)))
|
|
261 `(progn
|
|
262 ;; (defvar FOO) has no side effects.
|
|
263 ,@(mapcar #'(lambda (sym) `(defvar ,sym)) symbol)))
|
|
264
|
|
265 (defun byte-compile-with-fboundp (form)
|
|
266 (byte-compile-form (cons 'progn (cdr (cdr form))))
|
|
267 ;; Unfortunately, byte-compile-unresolved-functions is used not only
|
|
268 ;; for unresolved-function warnings, but also in connection with the
|
|
269 ;; following warnings:
|
|
270
|
|
271 ;; "defsubst %s was used before it was defined"
|
|
272 ;; "%s being defined to take %s%s, but was previously called with %s"
|
|
273
|
|
274 ;; By hacking byte-compile-unresolved-functions like this, we
|
|
275 ;; effectively disable these warnings. But code should not be using
|
|
276 ;; `with-fboundp' with a function defined later on in the same
|
|
277 ;; file, so this is not a big deal.
|
|
278
|
|
279 (let ((symbols (eval (car (cdr form)))))
|
|
280 (unless (consp symbols)
|
|
281 (setq symbols (list symbols)))
|
|
282 (setq symbols (mapcar #'(lambda (sym) (cons sym nil)) symbols))
|
|
283 (setq byte-compile-unresolved-functions
|
|
284 (set-difference byte-compile-unresolved-functions symbols
|
|
285 :key #'car))
|
|
286 ))
|
|
287
|
|
288 ;; EEEEEEEEVIL hack. We need to create our own byte-compilation
|
|
289 ;; method so that the proper variables are bound while compilation
|
|
290 ;; takes place (which is when the warnings get noticed and batched
|
|
291 ;; up). What we really want to do is make `with-fboundp' a macro
|
|
292 ;; that simply `progn's its BODY; but GOD DAMN IT, macros can't have
|
|
293 ;; their own byte-compilation methods! So we make `with-fboundp' a
|
|
294 ;; macro calling `with-fboundp-1', which is cleverly aliased to
|
|
295 ;; progn. This way we can put a byte-compilation method on
|
|
296 ;; `with-fboundp-1', and when interpreting, progn will duly skip
|
|
297 ;; the first, quoted argument, i.e. the symbol name. (We could make
|
|
298 ;; `with-fboundp-1' a regular function, but then we'd have to thunk
|
|
299 ;; BODY and eval it at runtime. We could probably just do this using
|
|
300 ;; (apply 'progn BODY), but the existing method is more obviously
|
|
301 ;; guaranteed to work.)
|
|
302 ;;
|
|
303 ;; In defense, cl-macs.el does a very similar thing with
|
|
304 ;; `cl-block-wrapper'.
|
|
305
|
|
306 (put 'with-fboundp-1 'byte-compile 'byte-compile-with-fboundp)
|
|
307 (defalias 'with-fboundp-1 'progn)
|
|
308
|
|
309 (put 'with-fboundp 'lisp-indent-function 1)
|
|
310 (defmacro with-fboundp (symbol &rest body)
|
|
311 "Evaluate BODY, but do not issue bytecomp warnings about SYMBOL.
|
|
312 SYMBOL must be quoted. When compiling this file, the warning `the
|
|
313 function SYMBOL is not known to be defined' will not occur. This is a
|
|
314 clean way to avoid such warnings. See also `declare-fboundp',
|
|
315 `if-fboundp', and `globally-declare-fboundp'."
|
|
316 `(with-fboundp-1 ,symbol ,@body))
|
|
317
|
|
318 (put 'if-fboundp 'lisp-indent-function 2)
|
|
319 (defmacro if-fboundp (symbol then &rest else)
|
|
320 "Equivalent to (if (fboundp SYMBOL) THEN ELSE) but handles bytecomp warnings.
|
|
321 When compiling this file, the warning `the function SYMBOL is not
|
|
322 known to be defined' will not occur. This is a clean way to avoid
|
|
323 such warnings. See also `declare-fboundp', `with-fboundp', and
|
|
324 `globally-declare-fboundp'."
|
|
325 `(with-fboundp ,symbol
|
|
326 (if (fboundp ,symbol) ,then ,@else)))
|
|
327
|
|
328 (defmacro declare-fboundp (form)
|
|
329 "Execute FORM (a function call) without bytecomp warnings about the call.
|
|
330 Sample usage is
|
|
331
|
|
332 (declare-fboundp (x-keysym-on-keyboard-sans-modifiers-p 'backspace))
|
|
333
|
|
334 which is equivalent to
|
|
335
|
|
336 (with-fboundp 'x-keysym-on-keyboard-sans-modifiers-p
|
|
337 (x-keysym-on-keyboard-sans-modifiers-p 'backspace))"
|
|
338 `(with-fboundp ',(car form) ,form))
|
|
339
|
|
340 (defmacro globally-declare-fboundp (symbol)
|
|
341 "Declare that all calls to function SYMBOL in this file are valid.
|
|
342 SYMBOL can also be a list of symbols. SYMBOL must be quoted.
|
|
343
|
|
344 When compiling this file, the warning `the function SYMBOL is not
|
|
345 known to be defined' will not occur regardless of where calls to
|
|
346 SYMBOL occur in the file.
|
|
347
|
|
348 In general, you should *NOT* use this; use `declare-fboundp',
|
|
349 `if-fboundp', or `with-fboundp' to wrap individual uses, as necessary.
|
|
350 That way, you're more likely to remember to put in the explicit checks
|
|
351 for the function's existence that are usually necessary. However,
|
|
352 `globally-declare-fboundp' is better in some circumstances, such as
|
|
353 when writing an ELisp package that makes integral use of
|
|
354 optionally-compiled-in functionality (typically, an interface onto a
|
|
355 system library) and checks for the existence of the functionality at
|
|
356 some entry point to the package. The file `ldap.el' is a good
|
|
357 example: It provides a layer on top of the optional LDAP ELisp
|
|
358 primitives, makes calls to them throughout its code, and verifies the
|
|
359 presence of LDAP support at load time. Putting calls to
|
|
360 `declare-fboundp' throughout the code would be a major annoyance."
|
|
361 (when (cl-compiling-file)
|
|
362 (setq symbol (eval symbol))
|
|
363 (if (not (consp symbol))
|
|
364 (setq symbol (list symbol)))
|
|
365 ;; Another hack. This works because the autoload environment is
|
|
366 ;; currently used ONLY to suppress warnings, and the actual
|
|
367 ;; autoload definition is not used. (NOTE: With this definition,
|
|
368 ;; we will get spurious "multiple autoloads for %s" warnings if we
|
|
369 ;; have an autoload later in the file for any functions in SYMBOL.
|
|
370 ;; This is not something that code should ever do, though.)
|
|
371 (setq byte-compile-autoload-environment
|
|
372 (append (mapcar #'(lambda (sym) (cons sym nil)) symbol)
|
|
373 byte-compile-autoload-environment)))
|
|
374 nil)
|
|
375
|
|
376 (defun byte-compile-with-byte-compiler-warnings-suppressed (form)
|
|
377 (let ((byte-compile-warnings byte-compile-warnings)
|
|
378 (types (car (cdr form))))
|
|
379 (unless (consp types)
|
|
380 (setq types (list types)))
|
|
381 (if (eq byte-compile-warnings t)
|
|
382 (setq byte-compile-warnings byte-compile-default-warnings))
|
|
383 (setq byte-compile-warnings (set-difference byte-compile-warnings types))
|
|
384 (byte-compile-form (cons 'progn (cdr (cdr form))))))
|
|
385
|
|
386 ;; Same hack here as with `with-fboundp'.
|
|
387 (put 'with-byte-compiler-warnings-suppressed-1 'byte-compile
|
|
388 'byte-compile-with-byte-compiler-warnings-suppressed)
|
|
389 (defalias 'with-byte-compiler-warnings-suppressed-1 'progn)
|
|
390
|
|
391 (put 'with-byte-compiler-warnings-suppressed 'lisp-indent-function 1)
|
|
392 (defmacro with-byte-compiler-warnings-suppressed (type &rest body)
|
|
393 "Evaluate BODY, but do not issue bytecomp warnings TYPE.
|
|
394 TYPE should be one of `redefine', `callargs', `subr-callargs',
|
|
395 `free-vars', `unresolved', `unused-vars', `obsolete', or `pedantic',
|
|
396 or a list of one or more of these symbols. (See `byte-compile-warnings'.)
|
|
397 TYPE must be quoted.
|
|
398
|
|
399 NOTE: You should *NOT* under normal circumstances be using this!
|
|
400 There are better ways of avoiding most of these warnings. In particular:
|
|
401
|
|
402 -- use (declare (special ...)) if you are making use of
|
|
403 dynamically-scoped variables.
|
|
404 -- use `with-fboundp', `declare-fboundp', `if-fboundp', or
|
|
405 `globally-declare-fboundp' to avoid warnings about undefined
|
|
406 functions when you know the function actually exists.
|
|
407 -- use `with-boundp', `declare-boundp', or `if-boundp' to avoid
|
|
408 warnings about undefined variables when you know the variable
|
|
409 actually exists.
|
|
410 -- use `with-obsolete-variable' or `with-obsolete-function' if you
|
|
411 are purposely using such a variable or function."
|
|
412 `(with-byte-compiler-warnings-suppressed-1 ,type ,@body))
|
|
413
|
|
414 ;; #### These should be more clever. You could (e.g.) try fletting
|
|
415 ;; `byte-compile-obsolete' or temporarily removing the obsolete info
|
|
416 ;; from the symbol and putting it back with an unwind-protect. (Or
|
|
417 ;; better, modify the byte-compiler to provide a proper solution, and
|
|
418 ;; fix these macros to use it if available, or fall back on the way
|
|
419 ;; below. Remember, these definitions need to work with an unchanged
|
|
420 ;; byte compiler so that they can be copied and used in packages.)
|
|
421
|
|
422 (put 'with-obsolete-variable 'lisp-indent-function 1)
|
|
423 (defmacro with-obsolete-variable (symbol &rest body)
|
|
424 "Evaluate BODY but do not warn about usage of obsolete variable SYMBOL.
|
|
425 SYMBOL must be quoted. See also `with-obsolete-function'."
|
|
426 `(with-byte-compiler-warnings-suppressed 'obsolete ,@body))
|
|
427
|
|
428 (put 'with-obsolete-function 'lisp-indent-function 1)
|
|
429 (defmacro with-obsolete-function (symbol &rest body)
|
|
430 "Evaluate BODY but do not warn about usage of obsolete function SYMBOL.
|
|
431 SYMBOL must be quoted. See also `with-obsolete-variable'."
|
|
432 `(with-byte-compiler-warnings-suppressed 'obsolete ,@body))
|
428
|
433
|
|
434
|
|
435 ;;; Interface to file-local byte-compiler parameters.
|
|
436 ;;; Redefined in bytecomp.el.
|
|
437
|
|
438 ;;; The great RMS speaketh:
|
|
439 ;;;
|
|
440 ;;; I nuked this because it's not a good idea for users to think of
|
|
441 ;;; using it. These options are a matter of installation preference,
|
|
442 ;;; and have nothing to do with particular source files; it's a
|
|
443 ;;; mistake to suggest to users that they should associate these with
|
|
444 ;;; particular source files. There is hardly any reason to change
|
|
445 ;;; these parameters, anyway. --rms.
|
|
446 ;;;
|
|
447 ;;; But I'll leave this stuff alone. --ben
|
|
448
|
|
449 (put 'byte-compiler-options 'lisp-indent-hook 0)
|
|
450 (defmacro byte-compiler-options (&rest args)
|
|
451 "Set some compilation-parameters for this file.
|
|
452 This will affect only the file in which it appears; this does nothing when
|
|
453 evaluated, or when loaded from a .el file.
|
|
454
|
|
455 Each argument to this macro must be a list of a key and a value.
|
|
456
|
|
457 Keys: Values: Corresponding variable:
|
|
458
|
|
459 verbose t, nil byte-compile-verbose
|
|
460 optimize t, nil, source, byte byte-optimize
|
|
461 warnings list of warnings byte-compile-warnings
|
|
462 file-format emacs19, emacs20 byte-compile-emacs19-compatibility
|
|
463
|
|
464 The value specified with the `warnings' option must be a list, containing
|
|
465 some subset of the following flags:
|
|
466
|
|
467 free-vars references to variables not in the current lexical scope.
|
|
468 unused-vars references to non-global variables bound but not referenced.
|
|
469 unresolved calls to unknown functions.
|
|
470 callargs lambda calls with args that don't match the definition.
|
502
|
471 subr-callargs calls to subrs with args that don't match the definition.
|
428
|
472 redefine function cell redefined from a macro to a lambda or vice
|
|
473 versa, or redefined to take a different number of arguments.
|
502
|
474 obsolete use of an obsolete function or variable.
|
|
475 pedantic warn of use of compatible symbols.
|
428
|
476
|
|
477 If the first element if the list is `+' or `-' then the specified elements
|
|
478 are added to or removed from the current set of warnings, instead of the
|
|
479 entire set of warnings being overwritten.
|
|
480
|
|
481 For example, something like this might appear at the top of a source file:
|
|
482
|
|
483 (byte-compiler-options
|
|
484 (optimize t)
|
|
485 (warnings (- callargs)) ; Don't warn about arglist mismatch
|
|
486 (warnings (+ unused-vars)) ; Do warn about unused bindings
|
|
487 (file-format emacs19))"
|
|
488 nil)
|
|
489
|
|
490 ;;; bytecomp-runtime.el ends here
|