git: 123b4031e96d - stable/13 - sys/stdatomic.h: be nicer to c++

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 04 Apr 2022 22:56:01 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=123b4031e96da7953704d027c41d72d8ec0bf77d

commit 123b4031e96da7953704d027c41d72d8ec0bf77d
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-03-27 21:16:15 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-04-04 22:55:33 +0000

    sys/stdatomic.h: be nicer to c++
    
    PR:     262683
    
    (cherry picked from commit c1a24b9dbeade11bfeedc91996672582f6ea32f2)
---
 sys/sys/stdatomic.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/sys/stdatomic.h b/sys/sys/stdatomic.h
index 4dc6d680f934..f4fd1c6ae60e 100644
--- a/sys/sys/stdatomic.h
+++ b/sys/sys/stdatomic.h
@@ -163,6 +163,11 @@ atomic_signal_fence(memory_order __order __unused)
 #endif
 }
 
+#if defined(__cplusplus) && !defined(_Bool)
+#define	_Bool	bool
+#define	__bool_locally_defined
+#endif
+
 /*
  * 7.17.5 Lock-free property.
  */
@@ -406,4 +411,9 @@ atomic_flag_clear(volatile atomic_flag *__object)
 }
 #endif /* !_KERNEL */
 
+#ifdef __bool_locally_defined
+#undef _Bool
+#undef __bool_locally_defined
+#endif
+
 #endif /* !_STDATOMIC_H_ */