Re: Linux 2.6.24-rc7 Build-Failure at__you_cannot_kmalloc_that_much
From: Arjan van de Ven
Date: Mon Jan 07 2008 - 23:21:25 EST
On Mon, 7 Jan 2008 10:31:53 -0800 (PST)
Christoph Lameter <clameter@xxxxxxx> wrote:
> We could replace the __you_cannot_kmalloc_that_much() with a BUG()
> statement so we have the same effect in SLAB?
>
sounds like a bad idea; a compile time failure is of course nicer than
a runtime failure for the cases we can find the bug at compile-time already.
We should however investigate using one of the two following gcc function attributes;
they can give the user a lot better diagnostic information than what we have
right now:
error ("message")
If this attribute is used on a function declaration and a call to
such a function is not eliminated through dead code elimination or
other optimizations, an error which will include message will be
diagnosed. This is useful for compile time checking, especially
together with __builtin_constant_p and inline functions where checking
the inline function arguments is not possible through extern char
[(condition) ? 1 : -1]; tricks. While it is possible to leave the
function undefined and thus invoke a link failure, when using this
attribute the problem will be diagnosed earlier and with exact location
of the call even in presence of inline functions or when not emitting
debugging information.
warning ("message")
If this attribute is used on a function declaration and a call to
such a function is not eliminated through dead code elimination or
other optimizations, a warning which will include message will be
diagnosed. This is useful for compile time checking, especially
together with __builtin_constant_p and inline functions. While it is
possible to define the function with a message in .gnu.warning*
section, when using this attribute the problem will be diagnosed
earlier and with exact location of the call even in presence of inline
functions or when not emitting debugging information.
--
If you want to reach me at my work email, use arjan@xxxxxxxxxxxxxxx
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
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/