[erlang-patches] Patch to remove useless casts from the ERTS emulator
Wed Feb 2 10:52:32 CET 2011
On 02/01/2011 11:22 PM, Jesper Louis Andersen wrote:
> This patch,
> git fetch git://github.com/jlouis/otp.git cocci-useless-cast
> serves two purposes. First, it removes all useless casts from the C
> code of the ERTS emulator. A useless cast is a cast of an expression
> that already has the type casted into. Second, it is an attempt to use
> Coccinelle, http://coccinelle.lip6.fr/ on the Erlang C source. While
> this is a simple Coccinelle-patch it is highly useful for doing
> transformations in-the-large on the code base as a whole. The semantic
> patch used is a mere 7 lines, but the patch in the branch is 120
> I have run the test suite for the emulator part only and it passes
> that. The caveat, however, is that I can only run a single platform
> here. Thus, I hope for an inclusion into 'pu' for some more cooking. I
> am also aware you may refrain from taking this patch as it is too
> invasive. On the other hand, useless casts are potentially dangerous
> if the type of the value is changed later as the cast then masks the
> type error that would have otherwise occurred.
I'll include your patch into 'pu' and let it cook for a while.
If there's any errors during test, I'll let you know.
Niclas Axelsson, Erlang/OTP
More information about the erlang-patches