[PATCH 2.4.31 9/9] gcc4: fix i386 struct_cpy() warnings

From: Mikael Pettersson
Date: Sun Jun 12 2005 - 06:33:53 EST


On i386 gcc4 generates a few compile-time warnings like:

process.c:556: warning: statement with no effect
process.c:569: warning: statement with no effect

This is because the i386 struct_cpy() macro references an
undefined variable when its two operands differ in size,
in the hope of turning a runtime error into a link-time error.

However, a simple variable reference has no effect, which
is why gcc4 complains.

The fix is to change it to a call to an undefined function.

Signed-off-by: Mikael Pettersson <mikpe@xxxxxxxxx>

include/asm-i386/string.h | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

diff -rupN linux-2.4.31/include/asm-i386/string.h linux-2.4.31.gcc4-i386-struct_cpy-warnings/include/asm-i386/string.h
--- linux-2.4.31/include/asm-i386/string.h 2001-08-12 11:35:53.000000000 +0200
+++ linux-2.4.31.gcc4-i386-struct_cpy-warnings/include/asm-i386/string.h 2005-06-12 11:52:25.000000000 +0200
@@ -337,7 +337,7 @@ extern void __struct_cpy_bug (void);
#define struct_cpy(x,y) \
({ \
if (sizeof(*(x)) != sizeof(*(y))) \
- __struct_cpy_bug; \
+ __struct_cpy_bug(); \
memcpy(x, y, sizeof(*(x))); \
})

-
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/