Re: [PATCH v2] Remove uninitialized_var()

From: David Rientjes
Date: Mon Oct 29 2012 - 14:55:01 EST


On Sun, 28 Oct 2012, Ingo Molnar wrote:

> I left it a bit mystic because in some cases this macro was
> mis-used not to suppress GCC being wrong, but to hide GCC being
> *right*: for example unused variable warnings in cases like:
>
> int uninitialized_var(var);
>
> #ifdef XYZ
> var = ...;
> ...
> #endif
>
> which (ab-)use was no doubt actively dangerous beyond being
> ugly. One such example is in arch/x86/mm/numa.c. (These cases
> now turn into clear (and always harmless) compiler warnings, as
> they should.)
>

I like initializing them to 0 or NULL because it will still emit the
"unused variable" warnings whereas using uninitialized_var() would not
with -Wall. It's quite possible that uninitialized_var() is actually
suppressing this warning for variables that aren't used.

I fixed a bug that was attributed to uninitialized var for rc1 in
43385846968b ("fs, xattr: fix bug when removing a name not in xattr
list"), so thanks very much for removing it entirely.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/