File: cc-bytecomp.el.html
This file is used to ensure that the CC Mode files are correctly compiled regardless the environment (e.g. if an older CC Mode with outdated macros are loaded during compilation). It also provides features to defeat the compiler warnings for selected symbols.
There's really nothing CC Mode specific here; this functionality ought to be provided by the byte compilers or some accompanying library. To use it from some package "foo.el", begin by putting the following blurb at the top of the file:
(eval-when-compile
(let ((load-path
(if (and (boundp 'byte-compile-dest-file)
(stringp byte-compile-dest-file))
(cons (file-name-directory byte-compile-dest-file) load-path)
load-path)))
(load "cc-bytecomp" nil t))
This (unfortunately rather clumsy) form will ensure that the cc-bytecomp.el in the same directory as foo.el is loaded during byte compilation of the latter.
At the end of foo.el there should normally be a "(provide 'foo)".
Replace it with "(cc-provide 'foo)"; that is necessary to restore
the environment after the byte compilation. If you don't have a
provide at the end, you have to add the following as the very
last form in the file:
(eval-when-compile (cc-bytecomp-restore-environment))
Now everything is set to use the various functions and macros in this package.
If your package is split into several files, you should use
cc-require, cc-require-when-compile or cc-load to load them.
That ensures that the files in the same directory always are
loaded, to avoid mixup with other versions of them that might exist
elsewhere in the load path.
To suppress byte compiler warnings, use the macros
cc-bytecomp-defun and cc-bytecomp-defvar.
This file is not used at all after the package has been byte compiled. It is however necessary when running uncompiled.
Defined variables (0)
Defined functions (15)
cc-bytecomp-boundp | (SYMBOL) |
cc-bytecomp-debug-msg | (&rest ARGS) |
cc-bytecomp-defun | (FUN) |
cc-bytecomp-defvar | (VAR) |
cc-bytecomp-fboundp | (SYMBOL) |
cc-bytecomp-is-compiling | () |
cc-bytecomp-is-loading | () |
cc-bytecomp-put | (SYMBOL PROPNAME VALUE) |
cc-conditional-require | (CC-PART CONDITION) |
cc-conditional-require-after-load | (CC-PART FILE CONDITION) |
cc-external-require | (FEATURE) |
cc-load | (CC-PART) |
cc-provide | (FEATURE) |
cc-require | (CC-PART) |
cc-require-when-compile | (CC-PART) |