[CLN-list] Re: optimization and warnings [Was: CLN 1.2.0]

Alexei Sheplyakov varg at theor.jinr.ru
Sun Jan 20 10:24:16 CET 2008


Hello!

On Sun, Jan 20, 2008 at 12:17:51PM +1100, Joerg Arndt wrote:

> by default you use
>  (1) only -O, I suggest to use -O2 (but not -O3).

I'm not sure if CLN code is safe to compile with plain -O2.

With CXXFLAGS="-m64 -O2 -Wall -march=k8 -finline-limit=2000" I get tons of
warnings like

../../include/cln/number.h: In constructor 'cln::cl_number::cl_number(float)':
../../include/cln/number.h:238: warning: type-punning to incomplete type might break strict-aliasing rules
../../include/cln/number.h: In member function 'cln::cl_number& cln::cl_number::operator=(float)':
../../include/cln/number.h:238: warning: type-punning to incomplete type might break strict-aliasing rules
../../include/cln/number.h: In constructor 'cln::cl_number::cl_number(double)':
../../include/cln/number.h:239: warning: type-punning to incomplete type might break strict-aliasing rules

Just for the record, I use
g++-4.1 (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).

>  (2) no warnings!, I suggest to use
>  -W -Wall -Wconversion -Wsign-promo -Wsign-compare -Wunused \
>  -Wshadow -Wundef

-Wall spews a lot of warnings, and signal/noise ratio is quite low for
this to be useful.

>   ... and -Werror if you are daring

Unfortunately, CLN won't compile with -Werror.

Best regards,
	Alexei

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/cln-list/attachments/20080120/4fa87d0e/attachment.pgp


More information about the CLN-list mailing list