* lisp/electric.el (electric-indent-mode-has-been-called): Remove.
[bpt/emacs.git] / lisp / progmodes / cc-bytecomp.el
index 1e6d960..1936627 100644 (file)
@@ -1,7 +1,6 @@
 ;;; cc-bytecomp.el --- compile time setup for proper compilation
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 2000-2014 Free Software Foundation, Inc.
 
 ;; Author:     Martin Stjernholm
 ;; Maintainer: bug-cc-mode@gnu.org
@@ -233,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
@@ -241,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)
@@ -267,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)))
@@ -339,30 +352,6 @@ at compile time, e.g. for macros and inline functions."
             (cc-bytecomp-debug-msg
              "cc-bytecomp-defun: Covered function %s" ',fun))))))
 
-(put 'cc-bytecomp-defmacro 'lisp-indent-function 'defun)
-(defmacro cc-bytecomp-defmacro (fun &rest temp-macro)
-  "Bind the symbol as a macro during compilation (and evaluation) of the
-file.  Don't use outside `eval-when-compile'."
-  `(let ((orig-fun (assq ',fun cc-bytecomp-original-functions)))
-     (if (not orig-fun)
-        (setq orig-fun
-              (list ',fun
-                    nil
-                    (if (fboundp ',fun)
-                        (progn
-                          (cc-bytecomp-debug-msg
-                           "cc-bytecomp-defmacro: Saving %s" ',fun)
-                          (symbol-function ',fun))
-                      (cc-bytecomp-debug-msg
-                       "cc-bytecomp-defmacro: Saving %s as unbound" ',fun)
-                      'unbound))
-              cc-bytecomp-original-functions
-              (cons orig-fun cc-bytecomp-original-functions)))
-     (defmacro ,fun ,@temp-macro)
-     (cc-bytecomp-debug-msg
-      "cc-bytecomp-defmacro: Bound macro %s" ',fun)
-     (setcar (cdr orig-fun) (symbol-function ',fun))))
-
 (defmacro cc-bytecomp-put (symbol propname value)
   "Set a property on a symbol during compilation (and evaluation) of
 the file.  Don't use outside `eval-when-compile'."