From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Can the byte-compiler check whether functions passed by name are defined? Date: Wed, 07 Aug 2013 21:25:45 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1375925167 20768 80.91.229.3 (8 Aug 2013 01:26:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Aug 2013 01:26:07 +0000 (UTC) Cc: Sebastian Wiesner , Klaus-Dieter Bauer , emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 08 03:26:08 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V7EzN-0006tA-5j for ged-emacs-devel@m.gmane.org; Thu, 08 Aug 2013 03:26:05 +0200 Original-Received: from localhost ([::1]:33751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7EzM-0006me-OM for ged-emacs-devel@m.gmane.org; Wed, 07 Aug 2013 21:26:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7EzC-0006cA-A1 for emacs-devel@gnu.org; Wed, 07 Aug 2013 21:26:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7Ez5-0003eu-1B for emacs-devel@gnu.org; Wed, 07 Aug 2013 21:25:54 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:24598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7Ez4-0003eg-PL; Wed, 07 Aug 2013 21:25:46 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFLd/Nq/2dsb2JhbABEuzWDWRdzgh8BBVYjEAsOJhIUGA0kiCTBLZEKA6R6gV6DEw X-IPAS-Result: Av8EABK/CFFLd/Nq/2dsb2JhbABEuzWDWRdzgh8BBVYjEAsOJhIUGA0kiCTBLZEKA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="20940083" Original-Received: from 75-119-243-106.dsl.teksavvy.com (HELO pastel.home) ([75.119.243.106]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 07 Aug 2013 21:25:39 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 72AB062EBF; Wed, 7 Aug 2013 21:25:45 -0400 (EDT) In-Reply-To: (Glenn Morris's message of "Wed, 07 Aug 2013 17:59:22 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162477 Archived-At: > (defun foo (&rest args) t) > (defun foo2 () (mapcar #'foo '(1 2 3))) [...] > foo.el:6:1:Warning: the function `foo' is not known to be defined. > (defun foo () #'assoc-ignore-case) [...] > foo.el:1:8:Warning: `function' is an obsolete variable. The patch below should fix them, indeed, thanks. Stefan === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2013-08-07 17:33:30 +0000 +++ lisp/emacs-lisp/bytecomp.el 2013-08-08 01:23:52 +0000 @@ -3574,12 +3574,12 @@ (when (and (symbolp f) (byte-compile-warning-enabled-p 'callargs)) (when (get f 'byte-obsolete-info) - (byte-compile-warn-obsolete (car form))) + (byte-compile-warn-obsolete f)) ;; Check to see if the function will be available at runtime ;; and/or remember its arity if it's unknown. (or (and (or (fboundp f) ; Might be a subr or autoload. - (byte-compile-fdefinition (car form) nil)) + (byte-compile-fdefinition f nil)) (not (memq f byte-compile-noruntime-functions))) (eq f byte-compile-current-form) ; ## This doesn't work ; with recursion.