Skip to content

Fix Visual Studio builds on master

Chun-wei Fan requested to merge fix-windows into master

Hi,

This attempts to fix the latest GJS sources from GIT master, by:

  • Prefixing uses of IN and OUT (and INOUT for the sake of consistency) in GjsArgumentFlags with ARG_, since things will clash badly with Windows SDK headers.
  • Overload the bitwise OR operator of GjsArgumentFlags to fix the build as Visual Studio does not like converting between unsigned char and GjsArgumentFlags directly. This is currently only done in arg-cache.cpp.

What's outstanding for this to fix the build on Visual Studio:

I am getting this when building arg-cache.cpp:

../../Users/fanc999/gjs/gi/arg-cache.cpp(500): error C3615: constexpr function 'Gjs::Arg::RegisteredIn::RegisteredIn' cannot result in a constant expression
../../Users/fanc999/gjs/gi/arg-cache.cpp(500): note: failure was caused by call of undefined function or one not declared 'constexpr'
../../Users/fanc999/gjs/gi/arg-cache.cpp(500): note: see usage of 'Gjs::Arg::Instance::Instance'
../../Users/fanc999/gjs/gi/arg-cache.cpp(500): note: This diagnostic occurred in the compiler generated function 'Gjs::Arg::RegisteredIn::RegisteredIn(GType,GIInfoType)'
../../Users/fanc999/gjs/gi/arg-cache.cpp(535): note: see reference to function 'Gjs::Arg::RegisteredIn::RegisteredIn(GType,GIInfoType)'

(the line 500 refers to the line using RegisteredType::RegisteredType; as listed in the block below.

struct RegisteredIn : Instance, RegisteredType, Transferable {
    using RegisteredType::RegisteredType;

    GType gtype() const override { return RegisteredType::gtype(); }
};

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports