[En-Nut-Discussion] SVN compilation fix: lanc111.c
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Mon Oct 5 18:34:19 CEST 2009
Hello,
with (avr-) gcc version 4.4.1 [gcc-4_4-branch revision 150839] (SUSE Linux)
recent Sourceforge SVN doesn't compile arch/avr/dev/lanc111.c:
cc1: warnings being treated as errors
../.././/arch/avr/dev/lanc111.c: In function 'NicRxLanc':
../.././/arch/avr/dev/lanc111.c:1206: error: dereferencing type-punned \
pointer will break strict-aliasing rules
../.././/arch/avr/dev/lanc111.c:1206: error: dereferencing type-punned \
pointer will break strict-aliasing rules
make[1]: *** [avr/dev/lanc111.o] Fehler 1
Appended patch provides a solution that compiles clean.
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: nut/arch/avr/dev/lanc111.c
===================================================================
--- nut/arch/avr/dev/lanc111.c (Revision 2740)
+++ nut/arch/avr/dev/lanc111.c (Arbeitskopie)
@@ -1203,7 +1203,10 @@
* set.
*/
for (;;) {
- if (*((uint32_t *) (ifn->if_mac)) && *((uint32_t *) (ifn->if_mac)) != 0xFFFFFFFFUL) {
+ uint32_t test_NULL = 0UL;
+ uint32_t test_MAX = 0xFFFFFFFFUL;
+
+ if ((memcmp(ifn->if_mac, &test_NULL, 4)) && (memcmp(ifn->if_mac, &test_MAX, 4))) {
break;
}
NutSleep(63);
More information about the En-Nut-Discussion
mailing list