Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Rampant autobuild warnings
- - By Newton [de] Date 2011-07-20 01:17
Hey, did anyone notice the rampant increase in compiler warnings in the nightly builds?

It's full of funny stuff like that:

warning:   ‘C4Value* C4Value::NextRef’

Anybody got an idea where that comes from  (and why it is that scrambled up)?
Parent - - By Zapper [de] Date 2011-07-20 05:46 Edited 2011-07-20 05:49

>It's full of funny stuff like that:


It's not only like that, it's exactly that. Around 2350 times.. :)

full example warning:

/home/ck/oc/oc-win32-mingw/openclonk/src/script/C4Value.h: In constructor ‘C4Value::C4Value()’:
/home/ck/oc/oc-win32-mingw/openclonk/src/script/C4Value.h:196: warning: ‘C4Value::Type’ will be initialized after
/home/ck/oc/oc-win32-mingw/openclonk/src/script/C4Value.h:193: warning:   ‘C4Value* C4Value::NextRef’
/home/ck/oc/oc-win32-mingw/openclonk/src/script/C4Value.h:68: warning:   when initialized here

That looks pretty valid to me. What is the problem with the one member being initialized after the other? Since when do you have to initialize members in the order of declaration?
Parent - - By Clonk-Karl [de] Date 2011-07-20 10:08
Members are always initialized in the order of declaration, even if the order in the constructor's initializer list is different. This leads to code being executed in a different order than the one in the code, which can be confusing and therefore causes a warning.
Reply
Parent - - By Sven2 [de] Date 2011-07-20 10:47
Are there any tools to adjust this automatically? My compiler does not produce this warning, so I will probably not put things in order.

Alternatively, we could just turn off this specific warning? :P
Parent - - By Günther [de] Date 2011-07-21 01:33

> Alternatively, we could just turn off this specific warning? :P


That's what I do. (-Wno-reorder, see WARNING_FLAGS in Makefile.am.) I think we had even a real bug that was caused by somebody carelessly silencing these warnings by changing the code, but no bug caught by them. That's pretty specific to our coding style, because the initialization lists are almost all trivial.
Reply
Parent - - By Isilkor Date 2011-07-21 13:00
No, what happened was I changed the variable arrangement and you shouted at me because it increased sizeof(C4Value).
Reply
Parent - By Günther [de] Date 2011-07-21 20:56
I didn't mean that one. I'm not even sure that the bug I mentioned was caused by silencing this particular warning, only that it was hidden in a big patch of silencing gcc warnings I deliberately switched off in the Makefile.am. I didn't complain much about it because I really should have made cmake use the same warning options. :-)
Reply
Parent - By PeterW [gb] Date 2011-07-20 11:16
Oh my, these silly imperative languages... ;)
Up Topic Development / Developer's Corner / Rampant autobuild warnings

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill