unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14496: cc-bytecomp-obsolete-fun doesn't work
@ 2013-05-29  1:56 Glenn Morris
  0 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2013-05-29  1:56 UTC (permalink / raw)
  To: 14496

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#14496: cc-bytecomp-obsolete-fun doesn't work
       [not found] <wbfvx6eegt.fsf@fencepost.gnu.org>
@ 2013-05-29  6:29 ` Glenn Morris
  2013-05-29 13:14   ` Stefan Monnier
  2013-05-31 17:39   ` Glenn Morris
  0 siblings, 2 replies; 5+ messages in thread
From: Glenn Morris @ 2013-05-29  6:29 UTC (permalink / raw)
  To: 14496

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#14496: cc-bytecomp-obsolete-fun doesn't work
  2013-05-29  6:29 ` Glenn Morris
@ 2013-05-29 13:14   ` Stefan Monnier
  2013-05-31 17:39   ` Glenn Morris
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2013-05-29 13:14 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14496

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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#14496: cc-bytecomp-obsolete-fun doesn't work
  2013-05-29  6:29 ` Glenn Morris
  2013-05-29 13:14   ` Stefan Monnier
@ 2013-05-31 17:39   ` Glenn Morris
  2013-05-31 17:46     ` Glenn Morris
  1 sibling, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2013-05-31 17:39 UTC (permalink / raw)
  To: 14496


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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#14496: cc-bytecomp-obsolete-fun doesn't work
  2013-05-31 17:39   ` Glenn Morris
@ 2013-05-31 17:46     ` Glenn Morris
  0 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2013-05-31 17:46 UTC (permalink / raw)
  To: 14496

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-31 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-29  1:56 bug#14496: cc-bytecomp-obsolete-fun doesn't work Glenn Morris
     [not found] <wbfvx6eegt.fsf@fencepost.gnu.org>
2013-05-29  6:29 ` Glenn Morris
2013-05-29 13:14   ` Stefan Monnier
2013-05-31 17:39   ` Glenn Morris
2013-05-31 17:46     ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).