diff options
author | Alan Mackenzie <acm@muc.de> | 2015-11-24 19:44:34 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2015-11-24 19:44:34 +0000 |
commit | 7233767e3c7362b36828e5e6f68d45a411a9e3a1 (patch) | |
tree | ed9613ea1f1216ffd26a41dbf8a60663429c3801 /lisp/progmodes/cc-bytecomp.el | |
parent | 33ec2ff0f8b77f3c10af395d3e8979508cd78c0a (diff) | |
download | emacs-7233767e3c7362b36828e5e6f68d45a411a9e3a1.tar.gz emacs-7233767e3c7362b36828e5e6f68d45a411a9e3a1.tar.bz2 emacs-7233767e3c7362b36828e5e6f68d45a411a9e3a1.zip |
CC Mode: eliminate almost all byte compilation warnings
* lisp/progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): Remove.
(cc-require): Remove the crude hack that saved and restored
byte-compile-noruntime-functions.
(cc-conditional-require, cc-conditional-require-after-load): New macros.
* lisp/progmodes/cc-defs.el (top level): Reformulate code which loaded
cc-fix.el using the new macros in cc-bytecomp.el.
* lisp/progmodes/cc-langs.el (c++-template-syntax-table)
(c-no-parens-syntax-table): Add extra "(eval ..)"s around "'(lambda ..)"
forms to remove the superflous quotes.
Diffstat (limited to 'lisp/progmodes/cc-bytecomp.el')
-rw-r--r-- | lisp/progmodes/cc-bytecomp.el | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index 81b7a822b82..ab53c39fbde 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el @@ -284,9 +284,6 @@ perhaps a `cc-bytecomp-restore-environment' is forgotten somewhere")) (cc-bytecomp-setup-environment) t)))) -(defvar cc-bytecomp-noruntime-functions nil - "Saved value of `byte-compile-noruntime-functions'.") - (defmacro cc-require (cc-part) "Force loading of the corresponding .el file in the current directory during compilation, but compile in a `require'. Don't use within @@ -296,19 +293,37 @@ Having cyclic cc-require's will result in infinite recursion. That's somewhat intentional." `(progn (eval-when-compile - (if (boundp 'byte-compile-noruntime-functions) ; in case load uncompiled - (setq cc-bytecomp-noruntime-functions - byte-compile-noruntime-functions)) (cc-bytecomp-load (symbol-name ,cc-part))) - ;; Hack to suppress spurious "might not be defined at runtime" warnings. - ;; The basic issue is that - ;; (eval-when-compile (require 'foo)) - ;; (require 'foo) - ;; produces bogus noruntime warnings about functions from foo. - (eval-when-compile - (setq byte-compile-noruntime-functions cc-bytecomp-noruntime-functions)) (require ,cc-part))) +(defmacro cc-conditional-require (cc-part condition) + "If the CONDITION is satisfied at compile time, (i) force the +file CC-PART.el in the current directory to be loaded at compile +time, (ii) generate code to load the file at load time. + +CC-PART will normally be a quoted name such as 'cc-fix. +CONDITION should not be quoted." + (if (eval condition) + (progn + (cc-bytecomp-load (symbol-name (eval cc-part))) + `(require ,cc-part)) + '(progn))) + +(defmacro cc-conditional-require-after-load (cc-part file condition) + "If the CONDITION is satified at compile time, (i) force the +file CC-PART.el in the current directory to be loaded at compile +time, (ii) generate an `eval-after-load' form to load CC-PART.el +after the loading of FILE. + +CC-PART will normally be a quoted name such as 'cc-fix. FILE +should be a string. CONDITION should not be quoted." + (if (eval condition) + (progn + (cc-bytecomp-load (symbol-name (eval cc-part))) + `(eval-after-load ,file + '(require ,cc-part))) + '(progn))) + (defmacro cc-provide (feature) "A replacement for the `provide' form that restores the environment after the compilation. Don't use within `eval-when-compile'." |