[alsa-devel] [PATCH 1/1] SOUND: azt3328, fix broken AZF_FMT_XLATE macro
andi at lisas.de
Sat Jan 22 21:01:27 CET 2011
On Sat, Jan 22, 2011 at 02:56:10PM +0100, Jiri Slaby wrote:
> Despite the AZF_FMT_XLATE macro looks totally weird and useless, it's
> heavily broken (apart it also broke my parser).
> The 'break' in the macro belongs to the do-while loop and not to the
> switch. So it always falls through the all cases till the end.
> Remove the do-while from the macro.
Hmm, there doesn't remain much to say other than "Double ouch. Mea culpa.".
However I'd like to add one bit, that the usual macro-side
do ... while(0) loop has been added by me due to a checkpatch.pl warning
which called for attention. IOW, it could be argued that checkpatch.pl
led people into ""improving"" formely "working" (whatever one may think of it)
Something to be investigated, methinks.
> Also people should terminate statements with semicolons. So force
> people to do so by removing the last one in the macro.
Oh dammit of course, I'm normally implementing it this way as well.
Unfortunately I failed to submit it that way in this particular case.
> I vote for removing that crap completely because it makes the code
> weird anyway -- you have to specify manually both of freq and bits
> which is I would expect to be avoided exactly by such a macro.
The reason that it broke your parser is certainly a very valid one.
Macro syntax is known to be arcane and quite variable between compilers
(e.g. I read that the gcc people said that they were the only one who
_really_ grokked macro evaluation order and token pasting the way
it was meant to be implemented - go figure...).
As such I support a change here.
I'll try to come up with a translation table instead,
or else probably best just revert this wetware fart.
More information about the Alsa-devel