From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Markus Triska Newsgroups: gmane.emacs.devel Subject: bytecomp.el: issue warning when `mapcar' is called for effect Date: Tue, 19 Jun 2007 18:46:39 +0200 Message-ID: <86myyvdh8w.fsf@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1182271638 28216 80.91.229.12 (19 Jun 2007 16:47:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Jun 2007 16:47:18 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 19 18:47:16 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I0grL-0004wX-V7 for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2007 18:47:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0grL-0005jN-BT for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2007 12:47:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I0grH-0005iZ-Pz for emacs-devel@gnu.org; Tue, 19 Jun 2007 12:47:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I0grG-0005iH-Vi for emacs-devel@gnu.org; Tue, 19 Jun 2007 12:47:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0grG-0005iE-QX for emacs-devel@gnu.org; Tue, 19 Jun 2007 12:47:10 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1I0grG-0005rR-8U for emacs-devel@gnu.org; Tue, 19 Jun 2007 12:47:10 -0400 Original-Received: (qmail invoked by alias); 19 Jun 2007 16:47:08 -0000 Original-Received: from chello062178240212.3.14.tuwien.teleweb.at (EHLO siduxbox) [62.178.240.212] by mail.gmx.net (mp031) with SMTP; 19 Jun 2007 18:47:08 +0200 X-Authenticated: #4064391 X-Provags-ID: V01U2FsdGVkX1+FTOM/2wKFzOnxUI0Ha9oJ9rbOGyZ7Rasdwu+L6+ vRtwvNXTQjdmyo X-Y-GMX-Trusted: 0 X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:73319 Archived-At: This makes the byte-compiler mention `mapc' and `dolist' where one of them is preferable over `mapcar'. 2007-06-19 Markus Triska * emacs-lisp/bytecomp.el (byte-compile-normal-call): Issue warning when `mapcar' is called for effect. Index: bytecomp.el =================================================================== RCS file: /sources/emacs/emacs/lisp/emacs-lisp/bytecomp.el,v retrieving revision 2.202 diff -c -r2.202 bytecomp.el *** bytecomp.el 14 Jun 2007 21:25:11 -0000 2.202 --- bytecomp.el 19 Jun 2007 16:44:36 -0000 *************** *** 2831,2836 **** --- 2831,2840 ---- (defun byte-compile-normal-call (form) (if byte-compile-generate-call-tree (byte-compile-annotate-call-tree form)) + (when (and for-effect (eq (car form) 'mapcar)) + (byte-compile-set-symbol-position 'mapcar) + (byte-compile-warn + "`mapcar' called for effect; use `mapc' or `dolist' instead")) (byte-compile-push-constant (car form)) (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster. (byte-compile-out 'byte-call (length (cdr form))))