GNU bug report logs - #14496
cc-bytecomp-obsolete-fun doesn't work

Previous Next

Packages: cc-mode, emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Wed, 29 May 2013 01:58:01 UTC

Severity: normal

Found in version 24.1

Fixed in version 25.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #9 received at 14496 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 14496 <at> debbugs.gnu.org
Subject: Re: bug#14496: cc-bytecomp-obsolete-fun doesn't work
Date: Wed, 29 May 2013 09:14:27 -0400
>> 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))





This bug report was last modified 7 years and 229 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.