Compilation failiure with FCMD_OBJ_CMD2

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
uwestoehr
Posts: 794
Joined: Sun Jan 27, 2019 3:21 am

Compilation failiure with FCMD_OBJ_CMD2

Postby uwestoehr » Thu Nov 14, 2019 12:26 pm

After commit git commit 4291a087b8cb912a51f9ce03f37cff63b5a40467 I can no longer compile FC:

Code: Select all

2>------ Build started: Project: FreeCADGui, Configuration: Release x64 ------
2>CommandFeat.cpp
2>D:\FreeCAD-git\src\Gui\CommandFeat.cpp(96): error C2059: syntax error: ')'
2>Done building project "FreeCADGui.vcxproj" -- FAILED.
3>------ Build started: Project: SketcherGui, Configuration: Release x64 ------
3>Command.cpp
3>D:\FreeCAD-git\src\Mod\Sketcher\Gui\Command.cpp(556): error C2059: syntax error: ')'
3>CommandSketcherTools.cpp
3>D:\FreeCAD-git\src\Mod\Sketcher\Gui\CommandSketcherTools.cpp(1968): error C2059: syntax error: ')'
3>D:\FreeCAD-git\src\Mod\Sketcher\Gui\CommandSketcherTools.cpp(2031): error C2059: syntax error: ')'
Werner, can you please have a look since it is your commit?
wmayer wrote:
Mon Nov 04, 2019 9:35 pm
.
thanks and regards
Uwe
wmayer
Site Admin
Posts: 14999
Joined: Thu Feb 19, 2009 10:32 am

Re: Compilation failiure with FCMD_OBJ_CMD2

Postby wmayer » Thu Nov 14, 2019 6:51 pm

Strange, on Linux I didn't get a build failure but the MSVC compiler struggles. So for now I have restored the old definition of the doCommand macro but left copyVisual unchanged.

Actually the old definitions of these macros are not strict ISO C++11 and when building with the -Wpedantic option (which is actually recommended) I get thousands of warnings. The example given in https://en.wikipedia.org/wiki/Variadic_macro#Example is supposed to be ISO compliant but in combination with FCMD_VOBJ_CMD2 the MSVC compiler has problems.
User avatar
uwestoehr
Posts: 794
Joined: Sun Jan 27, 2019 3:21 am

Re: Compilation failiure with FCMD_OBJ_CMD2

Postby uwestoehr » Thu Nov 14, 2019 9:53 pm

wmayer wrote:
Thu Nov 14, 2019 6:51 pm
Strange, on Linux I didn't get a build failure but the MSVC compiler struggles. So for now I have restored the old definition of the doCommand macro but left copyVisual unchanged.
Thanks. Now it compiles again.
I think the design of C leads to situations like this. Ideally a programming language should be designed that way that there is only one way to compile code. But well, at least C++ is ISO-normed ;)
wmayer
Site Admin
Posts: 14999
Joined: Thu Feb 19, 2009 10:32 am

Re: Compilation failiure with FCMD_OBJ_CMD2

Postby wmayer » Thu Nov 14, 2019 10:25 pm

But well, at least C++ is ISO-normed
But in this case a compiler extension is used and thus the code is not strict ISO C++ and that's why I used the -Wpedantic option to discover all this non-compliant code locations.