06-28-2017, 08:47 PM
(This post was last modified: 06-28-2017, 08:59 PM by Seadragon91.)
I tested APIFuzzing with cuberite debug mode.
Got an assertion failure for ... cBoat:MaterialToString
Passed 355 to cBoat:MaterialToString. The string value oak is the default, that will be returned for an unknown value:
Windows returns the expected: oak
Clang (3.9.1): returns oak and here it gets funny. Why?
This in the code:
It looks like clang completely ignores the ifndef. Had a thought and added a else branch that returns the string magic and clang suddenly returns magic
I replaced the code above with "return oak" and no warning appears in compiling. I guess if I could test a cuberite version compiled with clang 3.4 it will crash. Cannot install it, to old
Checked the linux version from the build server, it's compiled with clang 3.5. It also returns oak, no crash occurs. I think that clang 3.5 and above have a better detection for return values.
The best solution I think is to bump the minimum version of clang to 3.5 and change it in travis. Also then a pull request that removes all the #ifndef __clang__ in functions like cBoat:MaterialToString and the assertions
Got an assertion failure for ... cBoat:MaterialToString
Passed 355 to cBoat:MaterialToString. The string value oak is the default, that will be returned for an unknown value:
Windows returns the expected: oak
Clang (3.9.1): returns oak and here it gets funny. Why?
This in the code:
Code:
#ifndef __clang__
return "oak";
#endif
I replaced the code above with "return oak" and no warning appears in compiling. I guess if I could test a cuberite version compiled with clang 3.4 it will crash. Cannot install it, to old
Checked the linux version from the build server, it's compiled with clang 3.5. It also returns oak, no crash occurs. I think that clang 3.5 and above have a better detection for return values.
The best solution I think is to bump the minimum version of clang to 3.5 and change it in travis. Also then a pull request that removes all the #ifndef __clang__ in functions like cBoat:MaterialToString and the assertions