From 4a714e100e4a39d6219181bfc412ba208c9bb31a Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Sat, 4 Jan 2025 03:54:13 +0100 Subject: [PATCH] cgen: define _GNU_SOURCE on Linux For gettid() declaration (and other GNU-specific bits). --- vlib/v/gen/c/cgen.v | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 79a6bad86a3365..d67a4c6ec1b183 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -906,6 +906,10 @@ pub fn (mut g Gen) init() { #endif ') } + if g.pref.os == .linux { + // For gettid() declaration (and other GNU-specific bits). + g.cheaders.writeln('#define _GNU_SOURCE') + } if g.pref.os == .wasm32 { g.cheaders.writeln('#define VWASM 1') // Include instead of for WASM target