Warnings when build on Windows

Everything about development and the OpenMW source code.
Post Reply
dteviot
Posts: 144
Joined: 17 Dec 2014, 20:29

Warnings when build on Windows

Post by dteviot »

I just did a build on Windows and got 1,831 warnings from the compiler.
Mostly minor ones like:
\openmw\apps\openmw\mwworld\refdata.hpp(15): warning C4099: 'ESM::Script' : type name first seen using 'struct' now seen using 'class'
7>..\..\..\apps\openmw\mwrender\renderingmanager.cpp(151): warning C4305: 'argument' : truncation from 'double' to 'float'
7>..\..\..\apps\openmw\mwrender\renderingmanager.cpp(152): warning C4305: 'argument' : truncation from 'double' to 'float'

Funny thing is, I did a full build a few days ago and got none.
Has anyone else who builds on windows noticed the same thing?

I suspect the cause is commit c6aa374934f7ffbcb5bff6ba221cbc61cc1587e7, but I'm not positive.
Last edited by dteviot on 05 Mar 2015, 09:46, edited 1 time in total.
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: Warnings when build on Windows

Post by cc9cii »

Don't know for sure, but I think there might have been a recent change to CMake.
dteviot
Posts: 144
Joined: 17 Dec 2014, 20:29

Re: Warnings when build on Windows

Post by dteviot »

zini wrote:we are aiming for warning-less code
Which means someone(s?) is going to have to fix the warnings.
As there's a lot (1,831) some help would be nice.
It would probably also pay to co-ordinate our activity so that we don't double up our efforts.

I'm willing to start by fixing the following errors, as the fix is easy and requires only simple checking to confirm. So I can get rid of these easily and quickly. And so reduce the "noise level' of the warnings.
  • C4099: type name first seen using 'struct' now seen using 'class'
  • C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Warnings when build on Windows

Post by scrawl »

The linked commit should not have changed the warning levels. It just sets the warnings globally for all targets to get rid of some copypasta. If there are now different warnings, then we should investigate why cmake isn't passing the flags properly.

Then again, cleaning out the list of ignored warnings sounds like a good idea too. Some of them look like actual problems, e.g. the struct<->class mismatch.
dteviot
Posts: 144
Joined: 17 Dec 2014, 20:29

Re: Warnings when build on Windows

Post by dteviot »

scrawl wrote: Then again, cleaning out the list of ignored warnings sounds like a good idea too. Some of them look like actual problems, e.g. the struct<->class mismatch.
Actually, that's not a problem. It occurs when someone forward declares a class or struct. In C++, the only difference between the two is if the members are public or private by default.

i.e. in a header, someone does a forward declaration like
struct Cell;

then later on defines it as a class.

class Cell
{
...
}

Not a problem for compiler.
The warning that takes the time is the float to int conversion. As this results in truncation, need to carefully examine what's going on to make sure the conversion isn't going to cause problems. (I've already found one case where this resulted in an error.)
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Warnings when build on Windows

Post by scrawl »

Not a problem for compiler.
It seems to cause linking errors for MSVC every once in a while. Example: https://bugs.openmw.org/issues/362
dteviot
Posts: 144
Joined: 17 Dec 2014, 20:29

Re: Warnings when build on Windows

Post by dteviot »

scrawl wrote:
Not a problem for compiler.
It seems to cause linking errors for MSVC every once in a while. Example: https://bugs.openmw.org/issues/362
That's MSVC 2008.
I should have said, not a problem for the MSVC 2013 compiler.
Post Reply