From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Aur=C3=A9lien_Aptel?= Newsgroups: gmane.emacs.devel Subject: Re: Trying coccinelle Date: Mon, 18 Jun 2012 21:47:34 +0200 Message-ID: References: <4FDF5AF2.2080503@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1340048869 3045 80.91.229.3 (18 Jun 2012 19:47:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Jun 2012 19:47:49 +0000 (UTC) Cc: Emacs development discussions To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 18 21:47:48 2012 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 1SghvL-000339-10 for ged-emacs-devel@m.gmane.org; Mon, 18 Jun 2012 21:47:43 +0200 Original-Received: from localhost ([::1]:56238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SghvK-0007Q9-Ut for ged-emacs-devel@m.gmane.org; Mon, 18 Jun 2012 15:47:42 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SghvG-0007OM-Vc for emacs-devel@gnu.org; Mon, 18 Jun 2012 15:47:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SghvF-0000KX-AH for emacs-devel@gnu.org; Mon, 18 Jun 2012 15:47:38 -0400 Original-Received: from mail-ob0-f169.google.com ([209.85.214.169]:55709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SghvF-0000Ji-1u for emacs-devel@gnu.org; Mon, 18 Jun 2012 15:47:37 -0400 Original-Received: by obbtb8 with SMTP id tb8so3113807obb.0 for ; Mon, 18 Jun 2012 12:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=qadMMGqAcnBSrXVh2mBFquq/fRJnOrYdvUla8KrWPQ8=; b=tNHkFXrwHxVg64uI3NGnQ17K+5fLFqDUCiGfYbQhOOjDENW9Xaa0MvmDLJBlf/D6d9 BRjZk1HYCbTn2p87DAzRYJWqd95bd7G9YvNlt7H84JfSqAHM6xU8+LRLMNrZA4sL3mJI yhJ2iB6jir3zEGamGJC9iAqyGRGLAgUlWuQxMxz7ouWzfgk6TvgKeEOfopBWTENgRVNI IGmKLSyVzC99ci3r7Ew2d8CHaET/xSUegUhSXPK52SWyFp8qIc06R1iF1dCUyEw2Zuns sivzQZeOSuEvEWU3PtzPBOSdg+WCaEubArfyrChFg0ptVP4ViN9VNMCeoYIR9loTLF0N bL4g== Original-Received: by 10.182.119.33 with SMTP id kr1mr17123906obb.60.1340048854976; Mon, 18 Jun 2012 12:47:34 -0700 (PDT) Original-Received: by 10.182.241.7 with HTTP; Mon, 18 Jun 2012 12:47:34 -0700 (PDT) In-Reply-To: <4FDF5AF2.2080503@yandex.ru> X-Google-Sender-Auth: iq1zw4r9me-p4viCjBiOjBvQAV8 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.169 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:150995 Archived-At: On Mon, Jun 18, 2012 at 6:44 PM, Dmitry Antipov wrote: > but it seems that this tool opens a lot of other opportunities. For example, > attached patch was > generated with the very simple "semantic patch": > > @expression@ > identifier I1, I2; > expression E1, E2; > @@ > ( > - XVECTOR (I1)->contents[I2++] = E1 > + ASET (I1, I2, E1), I2++ > | > - XVECTOR (I1)->contents[E1] = E2 > + ASET (I1, E1, E2) > | > -XVECTOR (I1)->contents[E1] > +AREF (I1, E1) > ) > > and following minimal manual intervention, so I suspect that more useful > cleanups may be done > with this tool. > > Dmitry Nice work! I was the one who posted the link to coccinelle in the thread you mentioned. It's not the silver bullet to all problems but it's a great tool nonetheless. I hope your post convinced other devs to use it in emacs core when possible!