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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14496 in the body.
You can then email your comments to 14496 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#14496; Package emacs,cc-mode. (Wed, 29 May 2013 01:58:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: cc-bytecomp-obsolete-fun doesn't work
Date: Tue, 28 May 2013 21:56:18 -0400
Package: emacs,cc-mode
Version: 24.1

cc-bytecomp-obsolete-fun hasn't worked for 2+ years (Emacs 24.1
onwards), since it calls cc-bytecomp-ignore-obsolete, which uses
byte-compile-obsolete, which was removed 2011-04-01.

Since no-one has complained (and a web-search shows zero apparent users
of cc-bytecomp-obsolete-fun), please can it just be removed.


IMO most of the rest of cc-bytecomp should also be removed.
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.




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#14496; Package emacs,cc-mode. (Wed, 29 May 2013 06:31:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: 14496 <at> debbugs.gnu.org
Subject: Re: bug#14496: cc-bytecomp-obsolete-fun doesn't work
Date: Wed, 29 May 2013 02:29:13 -0400
Glenn Morris wrote:

> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#14496; Package emacs,cc-mode. (Wed, 29 May 2013 13:17:02 GMT) Full text and rfc822 format available.

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))





Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#14496; Package emacs,cc-mode. (Fri, 31 May 2013 17:41:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: 14496 <at> debbugs.gnu.org
Subject: Re: bug#14496: cc-bytecomp-obsolete-fun doesn't work
Date: Fri, 31 May 2013 13:39:17 -0400
PPS, In Emacs, cc-bytecomp-defun seems unecessary since Emacs 21.1.
It mainly seems to be used for things like:
   
   ;; Silence the compiler.
   (cc-bytecomp-defun set-keymap-parents)        ; XEmacs
   
   (if (cc-bytecomp-fboundp 'set-keymap-parents)
      (set-keymap-parents map c-mode-base-map))
   
to silence a compilation warning about set-keymap-parents not being known.
Since 21.1, the Emacs byte-compiler is smart enough to do that anyway
for function calls behind fboundp tests.




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#14496; Package emacs,cc-mode. (Fri, 31 May 2013 17:49:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: 14496 <at> debbugs.gnu.org
Subject: Re: bug#14496: cc-bytecomp-obsolete-fun doesn't work
Date: Fri, 31 May 2013 13:46:52 -0400
Glenn Morris wrote:

> Since 21.1, the Emacs byte-compiler is smart enough to do that anyway

Correction, 22.1. Anyway, "since a long time ago".




bug marked as fixed in version 25.1, send any further explanations to 14496 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 04 Dec 2017 03:15:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 01 Jan 2018 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 109 days ago.

Previous Next


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