From 2250d60559937040df9490663acd3f0c16c461be Mon Sep 17 00:00:00 2001 From: Maxwell Geng <33229754+MaxwellGengYF@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:18:37 +0800 Subject: [PATCH] cgen: support a `-d no_bool` option, for cgen compatibility with the C23 language standard (since `bool` is a builtin type and a keyword in it) (#21637) --- vlib/v/gen/c/cheaders.v | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/vlib/v/gen/c/cheaders.v b/vlib/v/gen/c/cheaders.v index b1aa01d18b769b..90b29aaa4c017b 100644 --- a/vlib/v/gen/c/cheaders.v +++ b/vlib/v/gen/c/cheaders.v @@ -681,15 +681,17 @@ typedef u8 array_fixed_byte_300 [300]; typedef struct sync__Channel* chan; -#ifndef __cplusplus - #ifndef bool - #ifdef CUSTOM_DEFINE_4bytebool - typedef int bool; - #else - typedef u8 bool; +#ifndef CUSTOM_DEFINE_no_bool + #ifndef __cplusplus + #ifndef bool + #ifdef CUSTOM_DEFINE_4bytebool + typedef int bool; + #else + typedef u8 bool; + #endif + #define true 1 + #define false 0 #endif - #define true 1 - #define false 0 #endif #endif