Question about %meson macros

Hello, I am trying package to update the https://build.opensuse.org/package/show/windows:mingw:win64/mingw64-glib2 package that I branched https://build.opensuse.org/package/show/home:Infrandomness:branches:windows:mingw:win64/mingw64-glib2,

I use the %meson macro but for some reason, that macro sets up some environment variables bringing up -Werror=return-type,
whenever the project tries to compile, it fails because gcc detects a warning of type return-type and treats it as an error, and gcc stops compiling;

I tried to retrace back that environment variable with the command " rpm --eval “%meson” ", but that’s what it brings up :


    export LANG=C.UTF-8                      
    export CFLAGS="${CFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}"     
    export CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" 
    export FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}"     
    export FCFLAGS="${FCFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}"   
    /usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . x86_64-suse-linux

I then checked the spec file https://build.opensuse.org/package/view_file/GNOME:Factory/glib2/glib2.spec?expand=1of the glib2 package https://build.opensuse.org/package/show/GNOME:Factory/glib2 from the factory, I can’t seem to figure out how it works there and not here, I have checked the patch files to see if the meson buildscript or the macro was being changed to remove that warning but it doesn’t seem to be the case…

I really don’t know where that “-Werror=return-type” comes from, and even less how to remove it or tell meson/gcc to continue even if a warning of type “return-type” is encountered, if someone has already worked around that, I’d like to know how.

Guessing but probably the most likely problem is what a Google search highlights…

In computer programming, the return type (or result type) defines and constrains the data type of the value returned from a subroutine or method. In many programming languages (especially statically-typed programming languages such as C, C++, Java) the return type must be explicitly specified when declaring a function.

From
Return type - Wikipedia.

TSU

It comes from %optflags RPM macro which is set by global project config: Project Configuration of openSUSE:Factory - openSUSE Build Service

and even less how to remove it

Export CFLAGS (or other xxxFLAGS as appropriate) with your desired values before using %meson macro.

or tell meson/gcc to continue even if a warning of type “return-type” is encountered

This is a real bug. You must fix it in program sources, not ignore. Default values in %optflags are there for a reason.