]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-bytecomp.el
octave-mode: Link to manual.
[gnu-emacs] / lisp / progmodes / cc-bytecomp.el
index e41455f7883943e7cbdb16d8ef055261ece04800..c9835bbefe27c5cce247eb2e4b4352d22a13aa0e 100644 (file)
@@ -232,6 +232,9 @@ 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
@@ -240,7 +243,18 @@ during compilation, but compile in a `require'.  Don't use within
 Having cyclic cc-require's will result in infinite recursion.  That's
 somewhat intentional."
   `(progn
-     (eval-when-compile (cc-bytecomp-load (symbol-name ,cc-part)))
+     (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-provide (feature)
@@ -266,7 +280,7 @@ somewhat intentional."
 during compilation, but do a compile time `require' otherwise.  Don't
 use within `eval-when-compile'."
   `(eval-when-compile
-     (if (and (featurep 'cc-bytecomp)
+     (if (and (fboundp 'cc-bytecomp-is-compiling)
              (cc-bytecomp-is-compiling))
         (if (or (not load-in-progress)
                 (not (featurep ,cc-part)))