[PATCH 2/2] gdb: remove TYPE_NAME macro

Tom Tromey tom@tromey.com
Sat May 16 18:18:50 GMT 2020


>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> 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

Tom


More information about the Gdb-patches mailing list