From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Glenn Morris <rgm@gnu.org>
Cc: 14496@debbugs.gnu.org
Subject: bug#14496: cc-bytecomp-obsolete-fun doesn't work
Date: Wed, 29 May 2013 09:14:27 -0400 [thread overview]
Message-ID: <jwv7giiaqf8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <f3txlm70zq.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 29 May 2013 02:29:13 -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))
next prev parent reply other threads:[~2013-05-29 13:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <wbfvx6eegt.fsf@fencepost.gnu.org>
2013-05-29 6:29 ` bug#14496: cc-bytecomp-obsolete-fun doesn't work Glenn Morris
2013-05-29 13:14 ` Stefan Monnier [this message]
2013-05-31 17:39 ` Glenn Morris
2013-05-31 17:46 ` Glenn Morris
2013-05-29 1:56 Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv7giiaqf8.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=14496@debbugs.gnu.org \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).