GwenNelson / distcc

Automatically exported from code.google.com/p/distcc
GNU General Public License v2.0
0 stars 0 forks source link

variable overlapping causing errors.. #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, 

It seems like s6_addr is a reserved type, on my macine (Gentoo linux,
building current svn trunk) i get the following error:
src/access.c: In function 'set_mask_inet6':
src/access.c:118:14: error: expected '=', ',', ';', 'asm' or '__attribute__' 
before '.' token
src/access.c:118:14: error: expected expression before '.' token
src/access.c:123:9: error: '__in6_u' undeclared (first use in this function)
src/access.c:123:9: note: each undeclared identifier is reported only once for 
each function it appears in
make: *** [src/access.o] Error 1

The fix is quite easy, when you see it:
This line:
        uint8_t *s6_addr = addr->s6_addr;

Expands to:
        uint8_t *__in6_u.__u6_addr8 = addr->__in6_u.__u6_addr8;

Which is wrong, this patch is against r730 on trunk.

This fixes it:

--- src/access.c.orig   2010-10-05 19:01:56.133363116 +0200
+++ src/access.c        2010-10-05 19:02:25.911554579 +0200
@@ -115,18 +115,18 @@
  * Set a v6 address, @p addr, to a mask of @p mask_size bits.
  **/
 static void set_mask_inet6(struct in6_addr *addr, int mask_bits) {
-    uint8_t *s6_addr = addr->s6_addr;
+    uint8_t *ip6_addr = addr->s6_addr;
     int allones_count = mask_bits / 8;
     int i;

     for (i = 0; i < allones_count; i++)
-        s6_addr[i] = allones8;
+        ip6_addr[i] = allones8;

-    s6_addr[i] = ~(allones8 >> (mask_bits % 8));
+    ip6_addr[i] = ~(allones8 >> (mask_bits % 8));
     i++;

     for (; i < 16; i++)
-        s6_addr[i] = 0;
+        ip6_addr[i] = 0;
 }
 #endif /* ENABLE_RFC2553 */

Original issue reported on code.google.com by Ian.Kuml...@gmail.com on 8 Oct 2010 at 7:06

GoogleCodeExporter commented 9 years ago
Thanks for the patch!
Applied to the distcc sources in the repository in svn revision 733.

Original comment by fergus.h...@gmail.com on 8 Oct 2010 at 7:33