Skip to content

gtk/gtkcssrgbavalue.c: Fix build on Visual Studio

Chun-wei Fan requested to merge master.msvc.fix into master

Hi,

From the commit message:

Visual Studio does not allow static or global variables to use non-constants in their aggregate initializers, so fix the build by doing such initializations as local and non-static initializations, which means some unavoidable duplication.

It seems that the current code in this file inadvertently made use of something outside of C99 in this case, from [1] and [2].

[1]: https://stackoverflow.com/questions/6131455/compile-error-c2099-initializer-is-not-a-constant [2]: https://www.drdobbs.com/the-new-c-declarations-initializations/184401377

Visual Studio does not allow static or global structures to use static storage duration by compound literals, which is actually a GCCism[1].

[1]: See https://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports