[Widelands-dev] clang compilation trouble

2014-06-16 Thread Tibor Bamhor
Hi All,

I tried to build widelands (trunk) on debian lenny with clang and run into
two problems:

first:

src/logic/widelands.h:68:19: error: constexpr variable 'INVALID_INDEX' must
be initialized by a constant
  expression
constexpr uint8_t INVALID_INDEX = std::numeric_limits::max();

It was fixed with adding 255 instead of std::numeric_limits::max();

and second problem:

src/ui_fsmenu/loadreplay.cc:221:68: error: use of undeclared identifier 'fn'
   [](const std::string& fn) {return
boost::ends_with(fn, REPLAY_SUFFIX);});
  ^
0  libLLVM-3.0.so.1 0x40daafc8
1  libLLVM-3.0.so.1 0x40dab4e4
2   0x4001e400 __kernel_sigreturn + 0
3  clang0x089cacc3
clang::Expr::hasAnyTypeDependentArguments(clang::Expr**, unsigned int) + 35
4  clang0x085eb294 clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, clang::ASTMultiPtr,
clang::SourceLocation, clang::Expr*, bool) + 628
[many lines follows]

Here I gave up and switched to gcc.

What can I do with this?

Tibor
___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] clang compilation trouble

2014-06-16 Thread Holger Rapp
> 
> src/logic/widelands.h:68:19: error: constexpr variable 'INVALID_INDEX' must 
> be initialized by a constant
>   expression
> constexpr uint8_t INVALID_INDEX = std::numeric_limits::max();
> 

seems like you are not using the http://libcxx.llvm.org/ which you should 
always use with clang. It defines max to be a constexpr.


> It was fixed with adding 255 instead of std::numeric_limits::max();
> 
> and second problem:
> 
> src/ui_fsmenu/loadreplay.cc:221:68: error: use of undeclared identifier 'fn'
>[](const std::string& fn) {return boost::ends_with(fn, 
> REPLAY_SUFFIX);});

that makes no sense to me. Seems like a clang bug. Which clang version is that?



smime.p7s
Description: S/MIME cryptographic signature
___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] clang compilation trouble

2014-06-16 Thread Tibor Bamhor
I have installed:

ii  clang1:3.0-6.2
  i386 Low-Level Virtual Machine (LLVM), C language
family frontend
ii  clang-format-3.5 1:3.5~svn198086-1~exp1
 i386 Tool to format C/C++/Obj-C code
ii  libclang-common-dev  1:3.0-6.2
  i386 clang library - Common development package
ii  libllvm3.0:i386  3.0-10
 i386 Low-Level Virtual Machine (LLVM), runtime library
ii  libllvm3.5:i386  1:3.5~svn198086-1~exp1
 i386 Modular compiler and toolchain technologies,
runtime library
ii  llvm-3.0 3.0-10
 i386 Low-Level Virtual Machine (LLVM)
ii  llvm-3.0-dev 3.0-10
 i386 Low-Level Virtual Machine (LLVM), libraries and
headers
ii  llvm-3.0-runtime 3.0-10
 i386 Low-Level Virtual Machine (LLVM), bytecode
interpreter


as for http://libcxx.llvm.org/  if the package should be named "libc++" - I
dont have such and no such package is available in my current
repositories...
Or perhaps the package is?

libstdc++6 - GNU Standard C++ Library v3


Tibor


2014-06-16 12:16 GMT+02:00 Holger Rapp :

>
> src/logic/widelands.h:68:19: error: constexpr variable 'INVALID_INDEX'
> must be initialized by a constant
>   expression
> constexpr uint8_t INVALID_INDEX = std::numeric_limits::max();
>
>
> seems like you are not using the http://libcxx.llvm.org/ which you should
> always use with clang. It defines max to be a constexpr.
>
>
> It was fixed with adding 255 instead
> of std::numeric_limits::max();
>
> and second problem:
>
> src/ui_fsmenu/loadreplay.cc:221:68: error: use of undeclared identifier
> 'fn'
>[](const std::string& fn) {return
> boost::ends_with(fn, REPLAY_SUFFIX);});
>
>
> that makes no sense to me. Seems like a clang bug. Which clang version is
> that?
>
>
___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] clang compilation trouble

2014-06-16 Thread Tibor Bamhor
Oh, I appologize: Debian 7 = Wheezy

And yes, with gcc it compiles flawlessly




2014-06-16 15:37 GMT+02:00 Teppo Maenpaa :

> On Mon, Jun 16, 2014 at 12:11:04PM +0200, Tibor Bamhor wrote:
>
>  I tried to build widelands (trunk) on debian lenny with clang and run into
>> two problems:
>>
>
> Can you compile it using the gnu compiler collection?
>
> Lenny is rather old; released in February 2009, support ended in 2012.
>
>
>  and second problem:
>>
>> src/ui_fsmenu/loadreplay.cc:221:68: error: use of undeclared identifier
>> 'fn'
>>   [](const std::string& fn) {return
>> boost::ends_with(fn, REPLAY_SUFFIX);});
>>
>
> Lambdas appeared with gcc-4.5. Considering that squeeze, which is newer,
> shipped with gcc-4.4, I would gues that Lenny's gcc does not support this.
>
> Squeeze (which replaced Lenny) ships with clang 2.7 and llvm 2.6, which
> are also older than what you have.
>
>  0  libLLVM-3.0.so.1 0x40daafc8
>>
>
> How did you install such new stuff on Lenny?
>
> Regards,
>
>
> Teppo
>
>
___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] clang compilation trouble

2014-06-16 Thread Teppo Maenpaa

On Mon, Jun 16, 2014 at 12:11:04PM +0200, Tibor Bamhor wrote:


I tried to build widelands (trunk) on debian lenny with clang and run into
two problems:


Can you compile it using the gnu compiler collection?

Lenny is rather old; released in February 2009, support ended in 2012.



and second problem:

src/ui_fsmenu/loadreplay.cc:221:68: error: use of undeclared identifier 'fn'
  [](const std::string& fn) {return
boost::ends_with(fn, REPLAY_SUFFIX);});


Lambdas appeared with gcc-4.5. Considering that squeeze, which is newer, 
shipped with gcc-4.4, I would gues that Lenny's gcc does not support this.


Squeeze (which replaced Lenny) ships with clang 2.7 and llvm 2.6, which are 
also older than what you have.



0  libLLVM-3.0.so.1 0x40daafc8


How did you install such new stuff on Lenny?

Regards,


Teppo


___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/one_world into lp:widelands

2014-06-16 Thread SirVer
Cool! I think it is easiest to just litter the code with NOCOMMIT(#sirver) or 
something greppable. I can then take a look at those things. 

-- 
https://code.launchpad.net/~widelands-dev/widelands/one_world/+merge/222708
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/one_world.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/one_world into lp:widelands

2014-06-16 Thread SirVer
Inline comments are fine too, of course.
-- 
https://code.launchpad.net/~widelands-dev/widelands/one_world/+merge/222708
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/one_world.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/one_world into lp:widelands

2014-06-16 Thread Shevonar
I changed some formatting issues and small obvious errors. I also changed 
documentation to doxygen comment style so it gets picked up.

Here are the remaining questions:
- Why did you hard code the compiler in compile.sh
- Why are critter sound_effect split in directory and name and not just a path 
to the sound file?
- widelands_streamread.h.THIS should be just .h but is not used anyways. Remove?
- '// TODO "stone" is defined as "granit" in the world': Can this be fixed 
easily? Seems to fit in the context of this commit.
- ResourceDescription::get_editor_pic looks very wired. I am not totally sure 
what this method does but I am almost sure that there is an easier way with 
less complexity to achieve the same result. However, you did not write this 
code.
- TerrainTypeFromString is just a helper method. I don't know how this is 
usually handled in C++ but I would have maybe used a private class method (I am 
more of a Java developer).
- Uint32 in src/sound/fxset.h: What is the difference between Uint32 and 
uint32_t? Should it be changed?
-- 
https://code.launchpad.net/~widelands-dev/widelands/one_world/+merge/222708
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/one_world.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/one_world into lp:widelands

2014-06-16 Thread SirVer
Thanks for the review! It is very much appreciated. You also caught some bugs 
that I have missed. Code reviews are such an awesome thing! nearly as good as 
pair programming.

> - Why did you hard code the compiler in compile.sh

good catch. gun did that and probably submitted the change by accident. I 
didn't see it. Reverted to trunk. 

- Why are critter sound_effect split in directory and name and not just a path 
to the sound file?

That is legacy. The sound_handler randomly picks one file of bird_*.ogg when 
directory/bird is requested. I am not sure where I should document that better. 
Changing the sound handler to accept files explicitly (as a list instead of a 
glob) is probably also a good idea.

- widelands_streamread.h.THIS should be just .h but is not used anyways. Remove?

Removed.

- - '// TODO "stone" is defined as "granit" in the world': Can this be fixed 
easily? Seems to fit in the context of this commit.

that code around that area seems wrong to me. This translates attribute = { 
"stone" } as the name of the resource named granit. I think the correct 
approach would be to make attributes translatable in the world or let the 
building define the out of resource message in its configuration, but I did not 
want to touch even more code for now. I expanded the TODO with this information.

- ResourceDescription::get_editor_pic looks very wired. I am not totally sure 
what this method does but I am almost sure that there is an easier way with 
less complexity to achieve the same result. However, you did not write this 
code.

Well, I think I probably did write this code - way back. I agree to its 
complexity, I do not fully understand how it does it either, but it essentially 
just picks one of the defined pictures for a given resource amount. I did not 
want to touch it for now as this change is already too big.

> TerrainTypeFromString.

It is correctly handled like this: it is a stand alone method in a .cc file in 
an anonymous namespace. That means that it is only visible in this .cc file 
where it is used.

- Uint32 in src/sound/fxset.h: What is the difference between Uint32 and 
uint32_t? Should it be changed?

One is the SDL typedef, one the C standard typedef. I agree to change this for 
consistency, but we should do it more globally. I opened bug 1330599 for that.

Please take another look.


-- 
https://code.launchpad.net/~widelands-dev/widelands/one_world/+merge/222708
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/one_world.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp