Re: [squid-users] Build issues with squid 3.1 and 3.2

From: <gewehre_at_gmx.net>
Date: Fri, 26 Aug 2011 06:43:44 +0200

> >
> > I'm then confronted with the old nemesis:
> > ...
> > cc1plus: warnings being treated as errors
> > Address.cc: In member function 'bool Ip::Address::IsSlaac() const':
> > Address.cc:279: warning: comparison is always false due to limited range
> of data type
> > Address.cc:280: warning: comparison is always false due to limited range
> of data type
> >
> > Some googling seems to suggest this is rather common with certain UNIX
> source codes and OS X (x86 little endian hardware).
>
> Strange. The comparison is constant and performed in network-order octet
> bitmaps. There should be no range conversions involved. Erasing possible
> endian problems is precisely why the htons() was used.
>
> Could you please test with replacing the "htons" on those lines with
> "static_cast<uint8_t>".
>
>
> PS. What compiler is reporting these?
>
> Amos

Changing "htons" to "static_cast<uint8_t>" got it past Address.cc. Then it stopped at:

libtool: compile: g++ -DHAVE_CONFIG_H -I../.. -I../../include -I../../lib -I../../src -I../../include -I/usr/include -I/usr/include -I../../libltdl -I/usr/include -I/usr/include -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g -O2 -c Config.cc -fno-common -DPIC -o .libs/Config.o
In file included from ../../src/protos.h:35,
                 from Config.cc:3:
../../src/Packer.h:46: error: 'va_list' has not been declared
../../src/Packer.h:59: error: expected constructor, destructor, or type conversion before 'void'
../../src/Packer.h:60: error: expected constructor, destructor, or type conversion before 'void'
../../src/Packer.h:61: error: expected constructor, destructor, or type conversion before 'void'
In file included from ../../src/protos.h:37,
                 from Config.cc:3:
../../src/ip/Address.h:187: error: 'u_short' does not name a type
../../src/ip/Address.h:195: error: 'u_short' does not name a type
../../src/ip/Address.h:367: error: field 'm_SocketAddr' has incomplete type
../../src/ip/Address.h:249: error: 'AF_UNSPEC' was not declared in this scope
../../src/ip/Address.h:280: error: 'AF_UNSPEC' was not declared in this scope
../../src/ip/Address.h:312: error: 'AF_UNSPEC' was not declared in this scope
../../src/ip/Address.h:386: error: expected initializer before '&' token
../../src/ip/Address.h: In constructor 'Ip::Address_list::Address_list()':
../../src/ip/Address.h:398: error: 'NULL' was not declared in this scope
../../src/ip/Address.h: In destructor 'Ip::Address_list::~Address_list()':
../../src/ip/Address.h:399: error: 'NULL' was not declared in this scope
In file included from Config.cc:3:
../../src/protos.h: At global scope:
../../src/protos.h:354: error: 'htcp_clr_reason' has not been declared
make[3]: *** [Config.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

The same issues persist with either of the two versions of gcc 4.x on my box, listed below:

gcc -v
Using built-in specs.
Target: i686-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --with-arch=nocona --with-tune=generic --program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)

gcc -v
Using built-in specs.
Target: i686-apple-darwin8
Configured with: /Builds/gcc/gcc_42-5564/build/obj/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/usr/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-gxx-include-dir=/usr/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin8 --host=i686-apple-darwin8 --target=i686-apple-darwin8
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5564)

---
Well, not sure the following "htons" needs to be changed or not. 
u_short
Ip::Address::SetPort(u_short prt)
{
    m_SocketAddr.sin6_port = htons<uint8_t>prt);
    return prt;
}
Replaced it with "static_cast" anyway, and got the following:
/bin/sh ../../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H  -I../.. -I../../include -I../../lib -I../../src -I../../include  -I/usr/include -I/usr/include -I../../libltdl  -I/usr/include -I/usr/include -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g -O2 -c -o Address.lo Address.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I../.. -I../../include -I../../lib -I../../src -I../../include -I/usr/include -I/usr/include -I../../libltdl -I/usr/include -I/usr/include -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g -O2 -c Address.cc  -fno-common -DPIC -o .libs/Address.o
Address.cc: In member function 'u_short Ip::Address::SetPort(u_short)':
Address.cc:803: error: expected `(' before 'prt'
make[3]: *** [Address.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone
Received on Fri Aug 26 2011 - 04:43:53 MDT

This archive was generated by hypermail 2.2.0 : Fri Aug 26 2011 - 12:00:02 MDT