Please find attached my updated patches refactoring the DEBUG macro (mostly).
I've moved the level limiting condition to the macro as requested by Simo.
I've separated the macro definition update from the invocation update.
I've tried using coccinelle ("spatch") to do the invocation update, but
unfortunately, it either puts all DEBUG macro arguments on a single line with
a simple semantic patch (debug.spatch), or puts parts of the concatenated
string literals on a single line with an unrolled version
(debug_unrolled.spatch). I haven't managed to find another way.
So, for this simple case, Perl seems to be better (if not so reliable).
I've used the following command to update the invocations:
grep -rwl --include '*.[hc]' DEBUG . |
while read f; do
perl -e 'use strict;
' < $f.orig > $f
And then manually fixed two or three cases where it got confused and has
broken the compilation. After that, coccinelle couldn't find any more places
You can either use the included patch, try applying one of the semantic
patches, or not convert the macro to variadic and not update the invocations
at all. You can still get the size reduction benefit and fix the flushing.
I will leave this up to you.
If you decide to try the semantic patches, they can be applied as such:
spatch --sp-file debug_unrolled.spatch -dir . | git apply
You will need the "coccinelle" package to get the "spatch" tool.
Show replies by date