GNU bug report logs - #15122
24.3.50; [PATCH] byte-compiler warnings about destructive functions

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sun, 18 Aug 2013 05:27:01 UTC

Severity: wishlist

Tags: wontfix

Found in version 24.3.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; [PATCH] byte-compiler warnings about destructive functions
Date: Sat, 17 Aug 2013 22:26:16 -0700 (PDT)
[Message part 1 (text/plain, inline)]
This StackOverflow entry suggested that the Emacs-Lisp byte compiler be
able to warn about the use of functions that are destructive, i.e., can
modify data structures in place:

http://stackoverflow.com/questions/17610046/elisp-destructive-operation-warning

Attached is a patch that provides this, at least a start.

It covers the basic functions that can perform in-place data structure 
modification: lists, strings, vectors and other arrays, symbol properties.
These are generally the functions identified as destructive or modifying
in the Elisp manual.

A comment in the code identifies some other possible candidates that
occurred to me while browsing the manual.  Modify the list of functions
as you see fit (variable `byte-compile-destructive-functions').

I'm no expert on some of the data structure implementations, and the
manual is sometimes not so clear about whether destructive modification
occurs.  And perhaps there are cases where although the modification is
destructive at an implementation level the user need not be concerned
about that level, so such functions should not be included.  Dunno.

Perhaps also something could be done in the future wrt recognition of
particular cases for `setf' modification.

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-08-07 on ODIEONE
Bzr revision: 113750 lekktu <at> gmail.com-20130808011911-0jzpc9xuncegg6x9
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 CFLAGS=-O0 -g3 LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'
[bytecomp-2013-08-17a.patch (application/octet-stream, attachment)]

This bug report was last modified 9 years and 94 days ago.

Previous Next


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