From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id CDDE3383E833 for ; Sat, 16 May 2020 19:10:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CDDE3383E833 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.193] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 2201A1E5F9; Sat, 16 May 2020 15:10:35 -0400 (EDT) Subject: Re: [PATCH 2/2] gdb: remove TYPE_NAME macro To: Tom Tromey , Simon Marchi Cc: Simon Marchi via Gdb-patches References: <20200514181812.25795-1-simon.marchi@efficios.com> <20200514181812.25795-2-simon.marchi@efficios.com> <877dxb7tuw.fsf@tromey.com> <62d1efcd-01bf-a23b-7608-4ba1f1bd8ebe@efficios.com> <87367z7ng5.fsf@tromey.com> From: Simon Marchi Message-ID: <84b324b6-480c-1ca4-a6c1-6568b63d7e4a@simark.ca> Date: Sat, 16 May 2020 15:10:34 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <87367z7ng5.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2020 19:10:37 -0000 On 2020-05-16 2:18 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> No, coccinelle doesn't work on C++ unfortunately. When there's a C++ > Simon> construct in a function, it just skips it it seems. > > Aha, cool. > > Simon> Also, coccinelle doesn't really allow to specify the output code style, > Simon> so it just never puts a space before the parenthesis. I worked around > Simon> that by making it use `a_very_unique_string` as the function name in its > Simon> output, so I could easily replace it with the desired value with sed: > > Nice hack. > > FWIW I wrote some Emacs Lisp to do this kind of transform. However, it > is mostly ad hoc -- I rewrite bits of it when I need a new change. I do > have one that does the "function form to method form". > > The main drawbacks of this are that elisp is pretty slow, and of course > it's relatively obscure. One of the big advantages is that I also > taught it to write the ChangeLog entries... :-) > > https://github.com/tromey/gdb-refactoring-scripts > > For example maybe this one could have been done with > > emacs --script .../rewriter.el method TYPE_NAME name I'd be curious to run it. This is what I get, it's probably not expected: $ emacs --script gdb-refactoring-scripts/rewriter.el method TYPE_NAME name Loading 00debian-vars... Loading /etc/emacs/site-start.d/50autoconf.el (source)... Loading /etc/emacs/site-start.d/50cmake-data.el (source)... Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)... Loading debian-ispell... Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)... Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)... Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)... Loading cjk-enc... Loading /etc/emacs/site-start.d/50latex-cjk-thai.el (source)... Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)... Loading /home/smarchi/src/binutils-gdb/gdb/gdb-refactoring-scripts/rewriter-method.el (source)... Symbol's function definition is void: directory-files-recursively My cwd is gdb's source directory. Any idea what's going wrong? Simon