aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2013-05-30 19:20:05 -0400
committerGlenn Morris2013-05-30 19:20:05 -0400
commit2a8bed1c0266166b759578fad0fc408067f6441c (patch)
tree3d54727cd2c87ea1373c94672cf01afc241cfa7b
parentd6d236e233ce5ae585786443b6ff38d45c355c51 (diff)
downloademacs-2a8bed1c0266166b759578fad0fc408067f6441c.tar.gz
emacs-2a8bed1c0266166b759578fad0fc408067f6441c.zip
cc-bytecomp tweaks for sake of byte-compiler
* lisp/progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): New. (cc-require): Suppress spurious "noruntime" warnings. (cc-require-when-compile): Use fboundp, for sake of compiler.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/progmodes/cc-bytecomp.el16
2 files changed, 18 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1803eb0f0f4..33f0f787d74 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12013-05-30 Glenn Morris <rgm@gnu.org> 12013-05-30 Glenn Morris <rgm@gnu.org>
2 2
3 * progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): New.
4 (cc-require): Suppress spurious "noruntime" warnings.
5 (cc-require-when-compile): Use fboundp, for sake of compiler.
6
3 * progmodes/cc-mode.el: Move load of cc-vars before that of 7 * progmodes/cc-mode.el: Move load of cc-vars before that of
4 cc-langs (which in turn loads cc-vars), to quieten compiler. 8 cc-langs (which in turn loads cc-vars), to quieten compiler.
5 9
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el
index e41455f7883..337a5292417 100644
--- a/lisp/progmodes/cc-bytecomp.el
+++ b/lisp/progmodes/cc-bytecomp.el
@@ -232,6 +232,9 @@ perhaps a `cc-bytecomp-restore-environment' is forgotten somewhere"))
232 (cc-bytecomp-setup-environment) 232 (cc-bytecomp-setup-environment)
233 t)))) 233 t))))
234 234
235(defvar cc-bytecomp-noruntime-functions nil
236 "Saved value of `byte-compile-noruntime-functions'.")
237
235(defmacro cc-require (cc-part) 238(defmacro cc-require (cc-part)
236 "Force loading of the corresponding .el file in the current directory 239 "Force loading of the corresponding .el file in the current directory
237during compilation, but compile in a `require'. Don't use within 240during compilation, but compile in a `require'. Don't use within
@@ -240,7 +243,16 @@ during compilation, but compile in a `require'. Don't use within
240Having cyclic cc-require's will result in infinite recursion. That's 243Having cyclic cc-require's will result in infinite recursion. That's
241somewhat intentional." 244somewhat intentional."
242 `(progn 245 `(progn
243 (eval-when-compile (cc-bytecomp-load (symbol-name ,cc-part))) 246 (eval-when-compile
247 (setq cc-bytecomp-noruntime-functions byte-compile-noruntime-functions)
248 (cc-bytecomp-load (symbol-name ,cc-part)))
249 ;; Hack to suppress spurious "might not be defined at runtime" warnings.
250 ;; The basic issue is that
251 ;; (eval-when-compile (require 'foo))
252 ;; (require 'foo)
253 ;; produces bogus noruntime warnings about functions from foo.
254 (eval-when-compile
255 (setq byte-compile-noruntime-functions cc-bytecomp-noruntime-functions))
244 (require ,cc-part))) 256 (require ,cc-part)))
245 257
246(defmacro cc-provide (feature) 258(defmacro cc-provide (feature)
@@ -266,7 +278,7 @@ somewhat intentional."
266during compilation, but do a compile time `require' otherwise. Don't 278during compilation, but do a compile time `require' otherwise. Don't
267use within `eval-when-compile'." 279use within `eval-when-compile'."
268 `(eval-when-compile 280 `(eval-when-compile
269 (if (and (featurep 'cc-bytecomp) 281 (if (and (fboundp 'cc-bytecomp-is-compiling)
270 (cc-bytecomp-is-compiling)) 282 (cc-bytecomp-is-compiling))
271 (if (or (not load-in-progress) 283 (if (or (not load-in-progress)
272 (not (featurep ,cc-part))) 284 (not (featurep ,cc-part)))