← Back to team overview

kicad-developers team mailing list archive

Re: Commit c8a6878 breaks compilation on msys2


wxASSERT shouldn't be used inside constexpr functions because some of their
code paths for it implement trap functions that use inline assembly. This
is not allowed by the C++14 standard, and is supposed to be part of C++2a.
Other code paths just call into system functions, so this will be highly
platform dependent unfortunately. It would be best for compatibility to
switch it over to wxLogDebug instead of the assert.


On Wed, Sep 4, 2019 at 6:36 PM jp charras <jp.charras@xxxxxxxxxx> wrote:

> common.h does not compile with msys2/gcc 9.1.0
> Here is the error message:
> In file included from D:/wxWidgets-3.1.1/include/wx/defs.h:851,
>                  from D:/wxWidgets-3.1.1/include/wx/wx.h:14,
>                  from E:/kicad-launchpad/gerber_dev/include/common.h:37,
>                  from
> E:/kicad-launchpad/gerber_dev/polygon/math_for_graphics.cpp:8:
> E:/kicad-launchpad/gerber_dev/include/common.h: In function 'constexpr
> ret_type KiROUND(fp_type)':
> E:/kicad-launchpad/gerber_dev/include/common.h:118:5: error: 'asm' in
> 'constexpr' function
>   118 |     wxASSERT( ret <= std::numeric_limits<ret_type>::max()
> Looks to me using wxASSERT here creates this issue.
> (I replaced wxASSERT by a printf controlled by the same condition to
> compile Kicad)
> --
> Jean-Pierre CHARRAS
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

Follow ups