bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14496: cc-bytecomp-obsolete-fun doesn't work


From: Stefan Monnier
Subject: bug#14496: cc-bytecomp-obsolete-fun doesn't work
Date: Wed, 29 May 2013 09:14:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> cc-bytecomp-defun is replaced by the standard `declare-function', which
>> works since Emacs 23.1 (and is defined in 22.2 onwards as a compat stub).
>> cc-bytecomp-defvar is replaced by `(defvar foo)' with no init value.
> PS I'd be happy to make those changes if they are acceptable.

I use the appended code for cc-bytecomp.el (plus the standard
boilerplate at beginning/end, of course ;-).

Note that with that code, I get some extra warnings.  The reason is that
cc-mode (especially via cc-lang) is initialized in a tortured way, which
calls the byte-compiler explicitly.

IIRC some of the problem is that if you compile a code like

   (defvar foo)
   (eval-when-compile
     (byte-compile '(lambda (x) (+ x foo))))

the compiler will warn you about an unknown `foo': the defvar does add
`foo' to byte-compile-bound-variables, but byte-compile begins by
re-binding byte-compile-bound-variables to nil.  IIUC cc-bytecomp-defvar
tries to address this problem with a major-ugly-hack.  I think a lot of
the rest is trying to solve similar things.

A better solution would be to rethink the way cc-lang works so
that cc-mode doesn't need to call byte-compile explicitly.


        Stefan


(defmacro cc-require (cc-part) `(require ,cc-part))
(defmacro cc-provide (feature) `(provide ,feature))
(defmacro cc-load (cc-part) `(load ,cc-part nil t nil))
(defmacro cc-require-when-compile (cc-part) `(require ,cc-part))
(defmacro cc-external-require (feature) `(require ,feature))
(defmacro cc-bytecomp-defvar (var) `(defvar ,var))
(defmacro cc-bytecomp-defun (fun) `(declare-function ,fun unspecified))
(defmacro cc-bytecomp-obsolete-var (symbol) ())
(defmacro cc-bytecomp-obsolete-fun (symbol) ())
(defmacro cc-bytecomp-boundp (symbol) `(boundp ,symbol))
(defmacro cc-bytecomp-fboundp (symbol) `(fboundp ,symbol))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]