From 0412ba36ee67b5b025187af0e7c6361fa71d438f Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 17 May 2026 00:12:15 +0300 Subject: [PATCH] stdatomic: fix TCC detection in atomic.h (same __GNUC__ issue) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TCC defines __GNUC__ as a compatibility macro, so conditions like `defined(__TINYC__) && !defined(__GNUC__)` are never true. This caused TCC to take the GCC/clang code path which uses _Atomic() casts and #include — both incompatible with TCC's `#define _Atomic volatile`. Fix all three occurrences in atomic.h to use simple `#ifdef __TINYC__`. --- thirdparty/stdatomic/nix/atomic.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/thirdparty/stdatomic/nix/atomic.h b/thirdparty/stdatomic/nix/atomic.h index ae42afab9..548940a9c 100644 --- a/thirdparty/stdatomic/nix/atomic.h +++ b/thirdparty/stdatomic/nix/atomic.h @@ -7,7 +7,7 @@ #ifndef __cplusplus // If C just use stdatomic.h -#if !defined(__TINYC__) || defined(__clang__) || defined(__GNUC__) +#ifndef __TINYC__ #include #endif #else @@ -19,7 +19,7 @@ /* x86 architecture: uses PAUSE instruction for efficient spinning */ #define cpu_relax() __asm__ __volatile__ ("pause") #elif defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM) - #if defined(__TINYC__) && !defined(__clang__) && !defined(__GNUC__) + #ifdef __TINYC__ /* TCC compiler limitation: assembly not supported on ARM */ #define cpu_relax() #else @@ -45,7 +45,7 @@ ::: "memory") /* Memory clobber to prevent instruction reordering */ #endif -#if defined(__TINYC__) && !defined(__clang__) && !defined(__GNUC__) +#ifdef __TINYC__ typedef volatile long long atomic_llong; typedef volatile unsigned long long atomic_ullong; -- 2.39.5