diff mbox series

libc: fix build in C23 mode

Message ID 20250419114403.879376-1-yselkowi@redhat.com
State New
Headers show
Series libc: fix build in C23 mode | expand

Commit Message

Yaakov Selkowitz April 19, 2025, 11:44 a.m. UTC
GCC 15 defaults to C23, in which bool, true, and false are keywords.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---

This should be a common breakage but I have not managed google
a common solution for this, what do others do?

---
 lib/libc/include/stdbool.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vaibhav Jain May 28, 2025, 9:49 a.m. UTC | #1
Hit the same problem recently with GCC-15 and had a similar fix in my
tree.

yselkowi@redhat.com writes:

> GCC 15 defaults to C23, in which bool, true, and false are keywords.
>
> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Hence,

Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>

> ---
>
> This should be a common breakage but I have not managed google
> a common solution for this, what do others do?
>
> ---
>  lib/libc/include/stdbool.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/libc/include/stdbool.h b/lib/libc/include/stdbool.h
> index 5b7d36a7effb..0e0f8c682ec4 100644
> --- a/lib/libc/include/stdbool.h
> +++ b/lib/libc/include/stdbool.h
> @@ -13,7 +13,7 @@
>  #ifndef _STDBOOL_H
>  #define _STDBOOL_H
>  
> -#ifndef __cplusplus
> +#if !defined(__cplusplus) && __STDC_VERSION__ < 202311L
>  typedef enum { false = 0, true } bool;
>  #endif
>  
> -- 
> 2.49.0
Thomas Huth June 23, 2025, 11:08 a.m. UTC | #2
On 28/05/2025 11.49, Vaibhav Jain wrote:
> 
> Hit the same problem recently with GCC-15 and had a similar fix in my
> tree.
> 
> yselkowi@redhat.com writes:
> 
>> GCC 15 defaults to C23, in which bool, true, and false are keywords.
>>
>> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Hence,
> 
> Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> 
>> ---
>>
>> This should be a common breakage but I have not managed google
>> a common solution for this, what do others do?
>>
>> ---
>>   lib/libc/include/stdbool.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/libc/include/stdbool.h b/lib/libc/include/stdbool.h
>> index 5b7d36a7effb..0e0f8c682ec4 100644
>> --- a/lib/libc/include/stdbool.h
>> +++ b/lib/libc/include/stdbool.h
>> @@ -13,7 +13,7 @@
>>   #ifndef _STDBOOL_H
>>   #define _STDBOOL_H
>>   
>> -#ifndef __cplusplus
>> +#if !defined(__cplusplus) && __STDC_VERSION__ < 202311L
>>   typedef enum { false = 0, true } bool;
>>   #endif

Thanks, committed now:

  https://gitlab.com/slof/slof/-/commit/277e043bde619c98beddf3d1c6780bc40cd2186d

  Thomas
diff mbox series

Patch

diff --git a/lib/libc/include/stdbool.h b/lib/libc/include/stdbool.h
index 5b7d36a7effb..0e0f8c682ec4 100644
--- a/lib/libc/include/stdbool.h
+++ b/lib/libc/include/stdbool.h
@@ -13,7 +13,7 @@ 
 #ifndef _STDBOOL_H
 #define _STDBOOL_H
 
-#ifndef __cplusplus
+#if !defined(__cplusplus) && __STDC_VERSION__ < 202311L
 typedef enum { false = 0, true } bool;
 #endif