Noob! New Install! Hello.vala warnings

From: https://wiki.gnome.org/Projects/Vala/Tutorial

class Demo.HelloWorld : GLib.Object {
    public static int main(string[] args) {
        stdout.printf("Hello, World\n");
        return 0;
    }
}

I got:

valac hello.vala
In file included from /usr/include/glib-2.0/glib/gthread.h:34,
from /usr/include/glib-2.0/glib/gasyncqueue.h:34,
from /usr/include/glib-2.0/glib.h:34,
from /usr/include/glib-2.0/gobject/gbinding.h:30,
from /usr/include/glib-2.0/glib-object.h:24,
from /home/dnormandin/Programming/vala/hello.vala.c:6:
/home/dnormandin/Programming/vala/hello.vala.c: In function ‘demo_hello_world_get_type’:
/usr/include/glib-2.0/glib/gatomic.h:131:5: warning: argument 2 of ‘__atomic_load’ discards ‘volatile’ qualifier [-Wincompatible-pointer-types]
131 | __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST);
| ^~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:262:7: note: in expansion of macro ‘g_atomic_pointer_get’
262 | (!g_atomic_pointer_get (location) &&
| ^~~~~~~~~~~~~~~~~~~~
/home/dnormandin/Programming/vala/hello.vala.c:116:13: note: in expansion of macro ‘g_once_init_enter’
116 | if (g_once_init_enter (&demo_hello_world_type_id__once)) {
| ^~~~~~~~~~~~~~~~~

It compiled okay, but what are all those warnings about? I hate seeing stuff like that right off the bat. TIA …

That is normal.

The C code Vala generate is ok, but because of how the way the code is generated the C compiler will spit out warnings.

There is also a Matrix room: #vala:gnome.org

So is there a way to turn off all those warnings?

Am I better off @ Matrix: #vala:gnome.org? Although I would have thought that I’d be OK right here somewhere in this forum. Thx …

The code Vala generates is really not okay, and should be fixed: "g_once_init_enter()" volatile qualifier issue (#1631) · Issues · GNOME / vala · GitLab

Try adding --target-glib=2.70 to the arguments of the Vala compiler.

My strong recommendation is always use -w when building C code generated by Vala. (The only reason to ever not use -w would be if you want to work on valac itself and are trying to make it emit code that triggers fewer C warnings.)

Example meson.build

That did the trick! Grazie mille!

Thx for your input …