Compile warnings on Windows with Visual Studio 2010

Bug #1202101 reported by Andreas Breitschopp
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Invalid
Low
Unassigned

Bug Description

The current BZR version 6629 leads to
- 4 compile errors -> already fixed!
- 415 compile warnings
on Windows using the Visual Studio 2010 setup compiler.

I've attached a full list of compile errors and warnings.

PS. For other warning reports, see bug 1258667 (Clang), bug 986611 (cppcheck) and bug 1278174 (flawfinder).

Revision history for this message
Andreas Breitschopp (ab-tools) wrote :
description: updated
description: updated
description: updated
description: updated
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for submitting this list.

I'd argue the compiler errors could be split out in a separate bug report and assigned a higher priority. I really want to keep WL buildable on VS too, not just GCC and Clang.

I took the liberty of adding a link to the GCC warning report in the summary, as they are somewhat similar. Hope you don't mind.

Changed in widelands:
importance: Undecided → Low
status: New → Triaged
description: updated
Revision history for this message
Andreas Breitschopp (ab-tools) wrote :

Thanks for your quick comment!

Regarding the compile error it should be only one line that needs a change: I have attached a patch that I think will fix that correctly. But someone with more C++ experience should have a look on it before committing. ;-)

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Oh wow... I did not know Visual Studio was so picky... normally that one should go through :-D ...
Anyway, your patch is completely correct. I committed it in bzr rev. 6630

Changed in widelands:
milestone: none → build18-rc1
status: Triaged → Fix Committed
Revision history for this message
Nasenbaer (nasenbaer) wrote :

Sorry... the warnings are of course still valid :)

summary: - Compile errors and warnings on Windows with Visual Studio 2010
+ Compile warnings on Windows with Visual Studio 2010
Changed in widelands:
status: Fix Committed → Confirmed
description: updated
Revision history for this message
SirVer (sirver) wrote :

Visual Studio is correct here by the way. According to the standard, array sizes must be constexpr in c++11 (and before const). Only c++14 will relax this a bit. That clang and gcc compiled this without any problems is actually just an extension of the standard.

Revision history for this message
Andreas Breitschopp (ab-tools) wrote :

As there were a lot of changes I did a new compilation test on Windows with BZR revision 6651 now:
unfortunately you have to change the title of this bug report again, because we do have 2 compiler errors again. ;-)

Please first apply attached patch to following compiler warning:
- unary minus on unsigned values and overwritten warnings by specifying the right compiler option in the CMake file for the VS compiler and
- removing not referenced variables in the code.

Revision history for this message
Andreas Breitschopp (ab-tools) wrote :

After applying the patch of the previous comment there are only 234 compiler warnings and the new 2 compiler errors left as you can see in attached list.

It would be great if somebody could take care of the 2 errors and maybe also have a deeper look on the first warnings. I'm happy to do some more testing afterwards again.

Revision history for this message
SirVer (sirver) wrote :

I applied the patch in r6652. I might have fixed the compilation errors in 6653.

Revision history for this message
Andreas Breitschopp (ab-tools) wrote :

I compiled revision 6654 again now and yes, your change fixed the two compiler errors.

But unfortunately the last commits also increased the warnings again to 349 (see new warnings list attached).

Revision history for this message
Andreas Breitschopp (ab-tools) wrote :

You don't like Visual Studio compilers, do you? ;-)

In the current BZR revision 6725 we do have about 2.500 compiler errors(!) again when trying to compile with Visual Studio 2010:
http://www.ab-tools.com/temp/Widelands-CompilerWarnings7.txt

Revision history for this message
SirVer (sirver) wrote :

most errors on this list just need some additional includes - this will be hard to get right without access to VS though, could you try adding them in?

Revision history for this message
SirVer (sirver) wrote :

as this is ongoing I remove targetting for it.

Changed in widelands:
milestone: build18-rc1 → none
description: updated
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

> You don't like Visual Studio compilers, do you? ;-)

Hehe, I guess this is an unfortunate consequence of the fact that the majority of developers are running some GNU/Linux distribution or Mac OS X. And since it is seldom built, we don't notice when it breaks. So we should probably have someone which looks after that from time to time. Who knows, maybe it would make it easier to attract Windows-developers if we make VS a compiler-target alongside GCC and Clang?

I wonder what the current state is when it comes to Visual Studio 2010 or later releases...

PS. And if we get things a bit more stable with regards to VS, I'm personally interested to see what VS's builtin static code analysis tool /analyze would find in the code. :)

description: updated
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

I've got more bad news I'm afraid. :( In the latest development version we have done several changes to the build process and organized the source code to be more modular. This is a good thing, as it allows for looser coupled code and easier for developers to get an overview over how things are connected. One of the negative side-effects of this is that we currently only support GCC and Clang/LLVM.

It shouldn't be too hard to re-add support for Visual Studio again, but we will need someone running Windows and the latest version* of VS to look into whether it is working and what needs to be done. I know it can sound disheartening that we've stopped supporting VS, but I would really like to see it listed among the list of supported compilers. If you want to work on this, please let us know and we'll be happy to assist with any answers or help we may be able to offer. :)

* we now require compiler support for various c++11 functionality which we use in the code base.

Changed in widelands:
status: Confirmed → Incomplete
tags: added: buildsystem cmake windows
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for widelands because there has been no activity for 60 days.]

Changed in widelands:
status: Incomplete → Expired
SirVer (sirver)
Changed in widelands:
status: Expired → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.