annotate lisp/progmodes/cc-bytecomp.el @ 73076:339a903c6d93

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sat, 23 Sep 2006 16:32:03 +0000
parents 3d8b060d10fb
children e3694f1cb928 8a1ee48a8386
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38401
diff changeset
1 ;;; cc-bytecomp.el --- compile time setup for proper compilation
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
69140
3d8b060d10fb cc-align.el, cc-awk.el, cc-bytecomp.el, cc-cmds.el, cc-compat.el,
Alan Mackenzie <acm@muc.de>
parents: 68773
diff changeset
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
3d8b060d10fb cc-align.el, cc-awk.el, cc-bytecomp.el, cc-cmds.el, cc-compat.el,
Alan Mackenzie <acm@muc.de>
parents: 68773
diff changeset
4 ;; Foundation, Inc.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Author: Martin Stjernholm
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; Maintainer: bug-cc-mode@gnu.org
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; Created: 15-Jul-2000
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; Version: See cc-mode.el
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; Keywords: c languages oop
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
38401
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 36920
diff changeset
12 ;; This file is part of GNU Emacs.
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 36920
diff changeset
13
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 36920
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
38401
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 36920
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 36920
diff changeset
17 ;; any later version.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18
38401
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 36920
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; GNU General Public License for more details.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 64699
diff changeset
25 ;; along with this program; see the file COPYING. If not, write to
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
26 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
27 ;; Boston, MA 02110-1301, USA.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 ;;; Commentary:
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 ;; This file is used to ensure that the CC Mode files are correctly
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 ;; compiled regardless the environment (e.g. if an older CC Mode with
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 ;; outdated macros are loaded during compilation). It also provides
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 ;; features to defeat the compiler warnings for selected symbols.
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
35 ;;
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
36 ;; There's really nothing CC Mode specific here; this functionality
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
37 ;; ought to be provided by the byte compilers or some accompanying
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
38 ;; library. To use it from some package "foo.el", begin by putting
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
39 ;; the following blurb at the top of the file:
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
40 ;;
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
41 ;; (eval-when-compile
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
42 ;; (let ((load-path
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
43 ;; (if (and (boundp 'byte-compile-dest-file)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
44 ;; (stringp byte-compile-dest-file))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
45 ;; (cons (file-name-directory byte-compile-dest-file) load-path)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
46 ;; load-path)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
47 ;; (load "cc-bytecomp" nil t))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
48 ;;
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
49 ;; This (unfortunately rather clumsy) form will ensure that the
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
50 ;; cc-bytecomp.el in the same directory as foo.el is loaded during
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
51 ;; byte compilation of the latter.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
52 ;;
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
53 ;; At the end of foo.el there should normally be a "(provide 'foo)".
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
54 ;; Replace it with "(cc-provide 'foo)"; that is necessary to restore
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
55 ;; the environment after the byte compilation. If you don't have a
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
56 ;; `provide' at the end, you have to add the following as the very
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
57 ;; last form in the file:
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
58 ;;
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
59 ;; (eval-when-compile (cc-bytecomp-restore-environment))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
60 ;;
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
61 ;; Now everything is set to use the various functions and macros in
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
62 ;; this package.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
63 ;;
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
64 ;; If your package is split into several files, you should use
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
65 ;; `cc-require', `cc-require-when-compile' or `cc-load' to load them.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
66 ;; That ensures that the files in the same directory always are
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
67 ;; loaded, to avoid mixup with other versions of them that might exist
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
68 ;; elsewhere in the load path.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
69 ;;
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
70 ;; To suppress byte compiler warnings, use the macros
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
71 ;; `cc-bytecomp-defun', `cc-bytecomp-defvar',
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
72 ;; `cc-bytecomp-obsolete-fun', and `cc-bytecomp-obsolete-var'.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
73 ;;
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
74 ;; This file is not used at all after the package has been byte
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
75 ;; compiled. It is however necessary when running uncompiled.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38401
diff changeset
78 ;;; Code:
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38401
diff changeset
79
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (defvar cc-bytecomp-unbound-variables nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 (defvar cc-bytecomp-original-functions nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (defvar cc-bytecomp-original-properties nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (defvar cc-bytecomp-loaded-files nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 (defvar cc-bytecomp-environment-set nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
86 (defmacro cc-bytecomp-debug-msg (&rest args)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
87 ;;`(message ,@args)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
88 )
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (defun cc-bytecomp-setup-environment ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 ;; Eval'ed during compilation to setup variables, functions etc
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 ;; declared with `cc-bytecomp-defvar' et al.
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
93 (if (not load-in-progress)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
94 ;; Look at `load-in-progress' to tell whether we're called
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
95 ;; directly in the file being compiled or just from some file
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
96 ;; being loaded during compilation.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (let (p)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (if cc-bytecomp-environment-set
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (error "Byte compilation environment already set - \
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 perhaps a `cc-bytecomp-restore-environment' is forgotten somewhere"))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (setq p cc-bytecomp-unbound-variables)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (while p
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (if (not (boundp (car p)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (progn
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (eval `(defvar ,(car p)))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
106 (set (car p) (intern (concat "cc-bytecomp-ignore-var:"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
107 (symbol-name (car p)))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
108 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
109 "cc-bytecomp-setup-environment: Covered variable %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
110 (car p))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (setq p (cdr p)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (setq p cc-bytecomp-original-functions)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (while p
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 (let ((fun (car (car p)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (temp-macro (car (cdr (car p)))))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
116 (if (not (fboundp fun))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
117 (if temp-macro
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
118 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
119 (eval `(defmacro ,fun ,@temp-macro))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
120 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
121 "cc-bytecomp-setup-environment: Bound macro %s" fun))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
122 (fset fun (intern (concat "cc-bytecomp-ignore-fun:"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
123 (symbol-name fun))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
124 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
125 "cc-bytecomp-setup-environment: Covered function %s" fun))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (setq p (cdr p)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (setq p cc-bytecomp-original-properties)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 (while p
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 (let ((sym (car (car (car p))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (prop (cdr (car (car p))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 (tempdef (car (cdr (car p)))))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
132 (put sym prop tempdef)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
133 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
134 "cc-bytecomp-setup-environment: Bound property %s for %s to %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
135 prop sym tempdef))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (setq p (cdr p)))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
137 (setq cc-bytecomp-environment-set t)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
138 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
139 "cc-bytecomp-setup-environment: Done"))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 (defun cc-bytecomp-restore-environment ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 ;; Eval'ed during compilation to restore variables, functions etc
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 ;; declared with `cc-bytecomp-defvar' et al.
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
144 (if (not load-in-progress)
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 (let (p)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 (setq p cc-bytecomp-unbound-variables)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 (while p
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 (let ((var (car p)))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
149 (if (boundp var)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
150 (if (eq (intern (concat "cc-bytecomp-ignore-var:"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
151 (symbol-name var)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
152 (symbol-value var))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
153 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
154 (makunbound var)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
155 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
156 "cc-bytecomp-restore-environment: Unbound variable %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
157 var))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
158 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
159 "cc-bytecomp-restore-environment: Not restoring variable %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
160 var))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 (setq p (cdr p)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 (setq p cc-bytecomp-original-functions)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 (while p
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 (let ((fun (car (car p)))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
165 (temp-macro (car (cdr (car p))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 (def (car (cdr (cdr (car p))))))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
167 (if (fboundp fun)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
168 (if (eq (or temp-macro
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
169 (intern (concat "cc-bytecomp-ignore-fun:"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
170 (symbol-name fun))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
171 (symbol-function fun))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
172 (if (eq def 'unbound)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
173 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
174 (fmakunbound fun)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
175 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
176 "cc-bytecomp-restore-environment: Unbound function %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
177 fun))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
178 (fset fun def)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
179 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
180 "cc-bytecomp-restore-environment: Restored function %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
181 fun))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
182 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
183 "cc-bytecomp-restore-environment: Not restoring function %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
184 fun))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 (setq p (cdr p)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 (setq p cc-bytecomp-original-properties)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (while p
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188 (let ((sym (car (car (car p))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 (prop (cdr (car (car p))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 (tempdef (car (cdr (car p))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 (origdef (cdr (cdr (car p)))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192 (if (eq (get sym prop) tempdef)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
193 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
194 (put sym prop origdef)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
195 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
196 "cc-bytecomp-restore-environment: Restored property %s for %s to %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
197 prop sym origdef))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
198 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
199 "cc-bytecomp-restore-environment: Not restoring property %s for %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
200 prop sym)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 (setq p (cdr p)))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
202 (setq cc-bytecomp-environment-set nil)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
203 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
204 "cc-bytecomp-restore-environment: Done"))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
205
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
206 (eval
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
207 ;; This eval is to avoid byte compilation of the function below.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
208 ;; There's some bug in XEmacs 21.4.6 that can cause it to dump core
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
209 ;; here otherwise. My theory is that `cc-bytecomp-load' might be
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
210 ;; redefined recursively during the `load' inside it, and if it in
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
211 ;; that case is byte compiled then the byte interpreter gets
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
212 ;; confused. I haven't succeeded in isolating the bug, though. /mast
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
214 '(defun cc-bytecomp-load (cc-part)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
215 ;; Eval'ed during compilation to load a CC Mode file from the source
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
216 ;; directory (assuming it's the same as the compiled file
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
217 ;; destination dir).
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
218 (if (and (boundp 'byte-compile-dest-file)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
219 (stringp byte-compile-dest-file))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
220 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
221 (cc-bytecomp-restore-environment)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
222 (let ((load-path
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
223 (cons (file-name-directory byte-compile-dest-file)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
224 load-path))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
225 (cc-file (concat cc-part ".el")))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
226 (if (member cc-file cc-bytecomp-loaded-files)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
227 ()
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
228 (setq cc-bytecomp-loaded-files
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
229 (cons cc-file cc-bytecomp-loaded-files))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
230 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
231 "cc-bytecomp-load: Loading %S" cc-file)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
232 (load cc-file nil t t)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
233 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
234 "cc-bytecomp-load: Loaded %S" cc-file)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
235 (cc-bytecomp-setup-environment)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
236 t))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
237
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
238 (defmacro cc-require (cc-part)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
239 "Force loading of the corresponding .el file in the current directory
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
240 during compilation, but compile in a `require'. Don't use within
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
241 `eval-when-compile'.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243 Having cyclic cc-require's will result in infinite recursion. That's
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 somewhat intentional."
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 `(progn
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
246 (eval-when-compile (cc-bytecomp-load (symbol-name ,cc-part)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247 (require ,cc-part)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
248
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 (defmacro cc-provide (feature)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 "A replacement for the `provide' form that restores the environment
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251 after the compilation. Don't use within `eval-when-compile'."
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 `(progn
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 (eval-when-compile (cc-bytecomp-restore-environment))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 (provide ,feature)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 (defmacro cc-load (cc-part)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
257 "Force loading of the corresponding .el file in the current directory
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
258 during compilation. Don't use outside `eval-when-compile' or
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
259 `eval-and-compile'.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261 Having cyclic cc-load's will result in infinite recursion. That's
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 somewhat intentional."
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 `(or (and (featurep 'cc-bytecomp)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 (cc-bytecomp-load ,cc-part))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 (load ,cc-part nil t nil)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
267 (defmacro cc-require-when-compile (cc-part)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
268 "Force loading of the corresponding .el file in the current directory
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
269 during compilation, but do a compile time `require' otherwise. Don't
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
270 use within `eval-when-compile'."
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
271 `(eval-when-compile
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
272 (if (and (featurep 'cc-bytecomp)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
273 (cc-bytecomp-is-compiling))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
274 (if (or (not load-in-progress)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
275 (not (featurep ,cc-part)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
276 (cc-bytecomp-load (symbol-name ,cc-part)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
277 (require ,cc-part))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
278
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
279 (defmacro cc-external-require (feature)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
280 "Do a `require' of an external package.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
281 This restores and sets up the compilation environment before and
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
282 afterwards. Don't use within `eval-when-compile'."
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
283 `(progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
284 (eval-when-compile (cc-bytecomp-restore-environment))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
285 (require ,feature)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
286 (eval-when-compile (cc-bytecomp-setup-environment))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
287
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 (defun cc-bytecomp-is-compiling ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 "Return non-nil if eval'ed during compilation. Don't use outside
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290 `eval-when-compile'."
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 (and (boundp 'byte-compile-dest-file)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 (stringp byte-compile-dest-file)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 (defmacro cc-bytecomp-defvar (var)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295 "Binds the symbol as a variable during compilation of the file,
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 to silence the byte compiler. Don't use within `eval-when-compile'."
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 `(eval-when-compile
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (if (boundp ',var)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
299 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
300 "cc-bytecomp-defvar: %s bound already as variable" ',var)
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 (if (not (memq ',var cc-bytecomp-unbound-variables))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
302 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
303 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
304 "cc-bytecomp-defvar: Saving %s (as unbound)" ',var)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
305 (setq cc-bytecomp-unbound-variables
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
306 (cons ',var cc-bytecomp-unbound-variables))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 (if (and (cc-bytecomp-is-compiling)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
308 (not load-in-progress))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 (progn
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 (defvar ,var)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
311 (set ',var (intern (concat "cc-bytecomp-ignore-var:"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
312 (symbol-name ',var))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
313 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
314 "cc-bytecomp-defvar: Covered variable %s" ',var))))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 (defmacro cc-bytecomp-defun (fun)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 "Bind the symbol as a function during compilation of the file,
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
318 to silence the byte compiler. Don't use within `eval-when-compile'.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
319
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
320 If the symbol already is bound as a function, it will keep that
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
321 definition. That means that this macro will not shut up warnings
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
322 about incorrect number of arguments. It's dangerous to try to replace
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
323 existing functions since the byte compiler might need the definition
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
324 at compile time, e.g. for macros and inline functions."
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325 `(eval-when-compile
48361
2ac046f0f384 (cc-bytecomp-defun): Fixed bug that caused existing function
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
326 (if (fboundp ',fun)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
327 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
328 "cc-bytecomp-defun: %s bound already as function" ',fun)
48361
2ac046f0f384 (cc-bytecomp-defun): Fixed bug that caused existing function
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
329 (if (not (assq ',fun cc-bytecomp-original-functions))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
330 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
331 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
332 "cc-bytecomp-defun: Saving %s (as unbound)" ',fun)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
333 (setq cc-bytecomp-original-functions
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
334 (cons (list ',fun nil 'unbound)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
335 cc-bytecomp-original-functions))))
48361
2ac046f0f384 (cc-bytecomp-defun): Fixed bug that caused existing function
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
336 (if (and (cc-bytecomp-is-compiling)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
337 (not load-in-progress))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
338 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
339 (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
340 (symbol-name ',fun))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
341 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
342 "cc-bytecomp-defun: Covered function %s" ',fun))))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 (put 'cc-bytecomp-defmacro 'lisp-indent-function 'defun)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 (defmacro cc-bytecomp-defmacro (fun &rest temp-macro)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 "Bind the symbol as a macro during compilation (and evaluation) of the
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 file. Don't use outside `eval-when-compile'."
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
348 `(let ((orig-fun (assq ',fun cc-bytecomp-original-functions)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
349 (if (not orig-fun)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
350 (setq orig-fun
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
351 (list ',fun
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
352 nil
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
353 (if (fboundp ',fun)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
354 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
355 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
356 "cc-bytecomp-defmacro: Saving %s" ',fun)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
357 (symbol-function ',fun))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
358 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
359 "cc-bytecomp-defmacro: Saving %s as unbound" ',fun)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
360 'unbound))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
361 cc-bytecomp-original-functions
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
362 (cons orig-fun cc-bytecomp-original-functions)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
363 (defmacro ,fun ,@temp-macro)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
364 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
365 "cc-bytecomp-defmacro: Bound macro %s" ',fun)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
366 (setcar (cdr orig-fun) (symbol-function ',fun))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 (defmacro cc-bytecomp-put (symbol propname value)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369 "Set a property on a symbol during compilation (and evaluation) of
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
370 the file. Don't use outside `eval-when-compile'."
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
371 `(eval-when-compile
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 (if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-properties))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
373 (progn
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
374 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
375 "cc-bytecomp-put: Saving property %s for %s with value %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
376 ,propname ,symbol (get ,symbol ,propname))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
377 (setq cc-bytecomp-original-properties
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
378 (cons (cons (cons ,symbol ,propname)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
379 (cons ,value (get ,symbol ,propname)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
380 cc-bytecomp-original-properties))))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
381 (put ,symbol ,propname ,value)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
382 (cc-bytecomp-debug-msg
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
383 "cc-bytecomp-put: Bound property %s for %s to %s"
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
384 ,propname ,symbol ,value)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
385
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
386 (defmacro cc-bytecomp-obsolete-var (symbol)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
387 "Suppress warnings that the given symbol is an obsolete variable.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
388 Don't use within `eval-when-compile'."
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
389 `(eval-when-compile
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390 (if (get ',symbol 'byte-obsolete-variable)
48653
eafa82fa3d92 (cc-bytecomp-obsolete-var): Add an else-clause to the if to avoid
Richard M. Stallman <rms@gnu.org>
parents: 48361
diff changeset
391 (cc-bytecomp-put ',symbol 'byte-obsolete-variable nil)
eafa82fa3d92 (cc-bytecomp-obsolete-var): Add an else-clause to the if to avoid
Richard M. Stallman <rms@gnu.org>
parents: 48361
diff changeset
392 ;; This avoids a superfluous compiler warning
eafa82fa3d92 (cc-bytecomp-obsolete-var): Add an else-clause to the if to avoid
Richard M. Stallman <rms@gnu.org>
parents: 48361
diff changeset
393 ;; about calling `get' for effect.
eafa82fa3d92 (cc-bytecomp-obsolete-var): Add an else-clause to the if to avoid
Richard M. Stallman <rms@gnu.org>
parents: 48361
diff changeset
394 t)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 (defun cc-bytecomp-ignore-obsolete (form)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 ;; Wraps a call to `byte-compile-obsolete' that suppresses the warning.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 (let ((byte-compile-warnings
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
399 (delq 'obsolete (append byte-compile-warnings nil))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
400 (byte-compile-obsolete form)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
401
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
402 (defmacro cc-bytecomp-obsolete-fun (symbol)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
403 "Suppress warnings that the given symbol is an obsolete function.
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 Don't use within `eval-when-compile'."
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405 `(eval-when-compile
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
406 (if (eq (get ',symbol 'byte-compile) 'byte-compile-obsolete)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
407 (cc-bytecomp-put ',symbol 'byte-compile
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
408 'cc-bytecomp-ignore-obsolete)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
409 ;; This avoids a superfluous compiler warning
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
410 ;; about calling `get' for effect.
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
411 t)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
412
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
413 (defmacro cc-bytecomp-boundp (symbol)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
414 "Return non-nil if the given symbol is bound as a variable outside
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
415 the compilation. This is the same as using `boundp' but additionally
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
416 exclude any variables that have been bound during compilation with
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
417 `cc-bytecomp-defvar'."
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
418 (if (and (cc-bytecomp-is-compiling)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
419 (memq (car (cdr symbol)) cc-bytecomp-unbound-variables))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
420 nil
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
421 `(boundp ,symbol)))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
422
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
423 (defmacro cc-bytecomp-fboundp (symbol)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
424 "Return non-nil if the given symbol is bound as a function outside
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
425 the compilation. This is the same as using `fboundp' but additionally
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
426 exclude any functions that have been bound during compilation with
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
427 `cc-bytecomp-defun'."
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
428 (let (fun-elem)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
429 (if (and (cc-bytecomp-is-compiling)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
430 (setq fun-elem (assq (car (cdr symbol))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
431 cc-bytecomp-original-functions))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
432 (eq (elt fun-elem 2) 'unbound))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
433 nil
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 48653
diff changeset
434 `(fboundp ,symbol))))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
436
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (provide 'cc-bytecomp)
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38401
diff changeset
438
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51714
diff changeset
439 ;;; arch-tag: 2d71b3ad-57b0-4b13-abd3-ab836e08f975
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38401
diff changeset
440 ;;; cc-bytecomp.el ends here