* 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.
(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
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'."
\f
;; cc-fix.el contains compatibility macros that should be used if
;; needed.
-(eval-and-compile
- (if (or (/= (regexp-opt-depth "\\(\\(\\)\\)") 2)
- (not (fboundp 'push)))
- (cc-load "cc-fix")))
-
-(when (featurep 'xemacs) ; There is now (2005/12) code in GNU Emacs CVS
- ; to make the call to f-l-c-k throw an error.
- (eval-after-load "font-lock"
- '(if (and (not (featurep 'cc-fix)) ; only load the file once.
- (let (font-lock-keywords)
- (font-lock-compile-keywords '("\\<\\>"))
- font-lock-keywords)) ; did the previous call foul this up?
- (load "cc-fix"))))
-
-;; The above takes care of the delayed loading, but this is necessary
-;; to ensure correct byte compilation.
-(eval-when-compile
- (if (and (featurep 'xemacs)
- (not (featurep 'cc-fix))
- (progn
- (require 'font-lock)
- (let (font-lock-keywords)
- (font-lock-compile-keywords '("\\<\\>"))
- font-lock-keywords)))
- (cc-load "cc-fix")))
-
-;; XEmacs 21.4 doesn't have `delete-dups'.
-(eval-and-compile
- (if (and (not (fboundp 'delete-dups))
- (not (featurep 'cc-fix)))
- (cc-load "cc-fix")))
+(cc-conditional-require
+ 'cc-fix (or (/= (regexp-opt-depth "\\(\\(\\)\\)") 2)
+ (not (fboundp 'push))
+ ;; XEmacs 21.4 doesn't have `delete-dups'.
+ (not (fboundp 'delete-dups))))
+
+(cc-conditional-require-after-load
+ 'cc-fix "font-lock"
+ (and
+ (featurep 'xemacs)
+ (progn
+ (require 'font-lock)
+ (let (font-lock-keywords)
+ (font-lock-compile-keywords '("\\<\\>"))
+ font-lock-keywords))))
+
\f
;;; Variables also used at compile time.
table)))
(c-lang-defvar c++-template-syntax-table
(and (c-lang-const c++-make-template-syntax-table)
- (funcall (c-lang-const c++-make-template-syntax-table))))
+ ;; The next eval remove a superfluous ' from '(lambda. This
+ ;; gets rid of compilation warnings.
+ (funcall (eval (c-lang-const c++-make-template-syntax-table)))))
(c-lang-defconst c-make-no-parens-syntax-table
;; A variant of the standard syntax table which is used to find matching
table))))
(c-lang-defvar c-no-parens-syntax-table
(and (c-lang-const c-make-no-parens-syntax-table)
- (funcall (c-lang-const c-make-no-parens-syntax-table))))
+ ;; See comment in `c++template-syntax-table' about the next `eval'.
+ (funcall (eval (c-lang-const c-make-no-parens-syntax-table)))))
(c-lang-defconst c-identifier-syntax-modifications
"A list that describes the modifications that should be done to the