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

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 26 Aug 2011 17:23:17 +1200

On 26/08/11 16:43, gewehre_at_gmx.net wrote:
>>>
>>> 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.
>

No. Port is a short size. htons() is correct and needed.

In this case u_short can safely be replaced with uint16_t. There are
many other files using u_short still despite efforts to remove those
type names.

I'll get around to another type purge shortly. For now you can add this
line to compat/os/macos.h:
   typedef u_short uint16_t;

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.14
   Beta testers wanted for 3.2.0.10
Received on Fri Aug 26 2011 - 05:23:27 MDT

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