[alsa-devel] Kill snd_assert()
tiwai at suse.de
Mon Aug 11 10:41:37 CEST 2008
as some people already mentioned, we have a pretty ugly macro, snd_assert().
Actually, this macro is sometimes useful, but the implementation including
the code flow in arguments is really bad.
I tried to kill this, either the following way:
- use WARN_ON() if the check is needed essentially regardless of
- remove snd_assert() for obviously unneeded code-paths
The new snd_BUG_ON() macro takes the condition, and works like
WARN_ON() if CONFIG_SND_DEBUG=y: prints the warning with stack trace,
and returns the evaluated value. When CONFIG_SND_DEBUG=n, the macro
returns always zero, so that the compiler will optimize out the
Since snd_BUG_ON() takes the condition of a bug, it's a negative
condition against snd_assert(). It follows BUG_ON() and WARN_ON(),
and easier to understand, IMO.
The patches are found on topic/remove-assert branch of my git tree:
I haven't merged this topic yet. If you have a big objection or a
better implementation idea, please let me know.
More information about the Alsa-devel