From 880cfce4e3d7676684cc2f7156fa19a14e0dd82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Wed, 21 May 2025 16:22:03 +0200 Subject: [PATCH] disable _Atomic and __thread keywords when writing on JetBrains --- Include/pyport.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Include/pyport.h b/Include/pyport.h index 3eac119bf8e8d8..8bd91de568ffa7 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -8,6 +8,22 @@ # error "Python's source code assumes C's unsigned char is an 8-bit type" #endif +/* + * Disable keywords and operators that are not recognized by CLion. + * + * This is only a temporary solution until CLion correctly supports them. + */ +#ifdef __JETBRAINS_IDE__ +/* + * Prevents false positives in CLion's static analysis which incorrectly + * detects _Atomic(size_t) and _Atomic(uintptr_t) as duplicated declarations + * of size_t and uintptr_t respectively. + */ +#define _Atomic(x) x + +/* Ignore C99 TLS extension '__thread' keyword. */ +#define __thread +#endif // Preprocessor check for a builtin preprocessor function. Always return 0 // if __has_builtin() macro is not defined.