Marc 'HE' Brockschmidt <[EMAIL PROTECTED]> quotes:

> | cc1: warnings being treated as errors
> | /build/buildd/elinks-0.12~20080127/src/intl/gettext/dcigettext.c: In 
> function '_nl_find_msg':
> | /build/buildd/elinks-0.12~20080127/src/intl/gettext/dcigettext.c:745: 
> warning: cast from pointer to integer of different size
> | /build/buildd/elinks-0.12~20080127/src/intl/gettext/dcigettext.c:746: 
> warning: cast from pointer to integer of different size

I see amd64 has given these warnings already in ELinks 0.11.3,
but there they didn't break the build, because configure was not
run with --enable-debug and so it did not add -Werror to $CFLAGS.
Please try the appended patch.

There has been a similar warning in src/network/ssl/socket.c, at
the gnutls_transport_set_ptr call.  That could also be silenced
with an extra cast, but this would in principle also require
changing the code that converts the pointer back to an integer,
and I can't find where that happens, so I'm not changing it now.
Perhaps there is no such code and the call could just be removed.

Debian bug 464384: fix cast warning in alignof

---
commit 3b93dcc4726d4363215233a780df34772d76ee09
tree 3b3b3712e96c7115d44f180758b71ee95aa43b59
parent a2c7af990b11e1772b9f3e26c372213aa0fb8b03
author Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Sat, 09 Feb 2008 00:24:45 +0200
committer Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Sat, 09 Feb 2008 00:24:45 
+0200

 NEWS                |    1 +
 src/osdep/generic.h |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index 06215f0..ac4c337 100644
--- a/NEWS
+++ b/NEWS
@@ -131,6 +131,7 @@ Miscellaneous:
 
 Build system and compile-time errors (ignore if you don't build ELinks):
 
+* serious Debian bug 464384: fix cast warning in alignof
 * bug 725: fix version checking for Ruby in 'configure'
 * enhancement: if make -k was used and a sub-Make fails, build the
   rest before propagating
diff --git a/src/osdep/generic.h b/src/osdep/generic.h
index 9223cd5..357b602 100644
--- a/src/osdep/generic.h
+++ b/src/osdep/generic.h
@@ -102,7 +102,7 @@ safe_write(int fd, const void *buf, size_t count) {
 
 /* Alignment of types.  */
 #define alignof(TYPE) \
-    ((int) &((struct { unsigned char dummy1; TYPE dummy2; } *) 0)->dummy2)
+    offsetof(struct { unsigned char dummy1; TYPE dummy2; }, dummy2)
 
 /* Using this macro to copy structs is both faster and safer than
  * memcpy(destination, source, sizeof(source)). Please, use this macro instead

Attachment: pgpofbjN5hgWE.pgp
Description: PGP signature

Reply via email to