Description: Rename tinycthread once_flag/ONCE_FLAG_INIT to tct_ prefix
 tinycthread.h unconditionally defines _GNU_SOURCE on POSIX systems, which
 makes glibc >= 2.43 enable _ISOC23_SOURCE and thus __GLIBC_USE (ISOC23)
 regardless of the -std= dialect.  <stdlib.h> then includes
 bits/types/once_flag.h and declares the C23 identifiers once_flag and
 ONCE_FLAG_INIT.  Because tinycthread.h mapped these names to
 pthread_once_t / PTHREAD_ONCE_INIT with object-like macros, the library
 typedef was rewritten to __once_flag and the build failed with:
 .
   tinycthread.h:471:21: error: conflicting types for 'pthread_once_t';
   have '__once_flag'
 .
 Rename the bundled identifiers to tct_once_flag / TCT_ONCE_FLAG_INIT, the
 tct_ prefix already used by every other public tinycthread identifier, so
 they no longer collide with the ISO C23 names exposed by glibc.  This is a
 generic (arch-independent) fix and does not depend on the C standard.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Origin: vendor
Forwarded: not-needed
Last-Update: 2026-10-20

--- r-cran-later-1.4.6+dfsg.orig/src/tinycthread.c
+++ r-cran-later-1.4.6+dfsg/src/tinycthread.c
@@ -894,7 +894,7 @@ int _tthread_timespec_get(struct timespe
 #endif /* _TTHREAD_EMULATE_TIMESPEC_GET_ */
 
 #if defined(_TTHREAD_WIN32_)
-void tct_call_once(once_flag *flag, void (*func)(void))
+void tct_call_once(tct_once_flag *flag, void (*func)(void))
 {
   /* The idea here is that we use a spin lock (via the
      InterlockedCompareExchange function) to restrict access to the
--- r-cran-later-1.4.6+dfsg.orig/src/tinycthread.h
+++ r-cran-later-1.4.6+dfsg/src/tinycthread.h
@@ -465,11 +465,11 @@ int tct_tss_set(tct_tss_t key, void *val
   typedef struct {
     LONG volatile status;
     CRITICAL_SECTION lock;
-  } once_flag;
-  #define ONCE_FLAG_INIT {0,}
+  } tct_once_flag;
+  #define TCT_ONCE_FLAG_INIT {0,}
 #else
-  #define once_flag pthread_once_t
-  #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
+  typedef pthread_once_t tct_once_flag;
+  #define TCT_ONCE_FLAG_INIT PTHREAD_ONCE_INIT
 #endif
 
 /** Invoke a callback exactly once
@@ -478,7 +478,7 @@ int tct_tss_set(tct_tss_t key, void *val
  * @param func Callback to invoke.
  */
 #if defined(_TTHREAD_WIN32_)
-  void tct_call_once(once_flag *flag, void (*func)(void));
+  void tct_call_once(tct_once_flag *flag, void (*func)(void));
 #else
   #define tct_call_once(flag,func) pthread_once(flag,func)
 #endif
