Description: Fix FTBFS with gcc 15 + glibc 2.43 (C23 once_flag clash)
 gcc 15 compiles C sources as C23 (gnu23) by default.  With glibc >= 2.43,
 <stdlib.h> additionally declares the C23 type once_flag and the macro
 ONCE_FLAG_INIT under __GLIBC_USE (ISOC23) via bits/types/once_flag.h.
 tinycthread.h (bundled by later) defines both names itself, mapping them to
 pthread_once_t / PTHREAD_ONCE_INIT, and tinycthread.c includes <stdlib.h>
 after tinycthread.h.  The macro therefore rewrote the C library typedef and
 the build failed with:
 .
   tinycthread.h:471:21: error: conflicting types for 'pthread_once_t';
   have '__once_flag'
 .
 Build the C sources with the C17 standard as gcc 14 and earlier did, so the
 C library does not expose the C23 once_flag name and the existing
 tinycthread.h mapping stays valid.  Only C compilation is affected; C++
 sources keep the -std=gnu++17 selected by R.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Origin: vendor
Forwarded: not-needed
Last-Update: 2026-10-20

--- r-cran-later-1.4.6+dfsg.orig/src/Makevars.in
+++ r-cran-later-1.4.6+dfsg/src/Makevars.in
@@ -1,6 +1,16 @@
 PKG_CPPFLAGS = -pthread -DSTRICT_R_HEADERS -DRCPP_NO_MODULES @pkg_cppflags@
 PKG_LIBS = -pthread @extra_pkg_libs@
 
+#### C standard ####
+# gcc 15 compiles C sources as C23 (gnu23) by default.  With glibc >= 2.43,
+# <stdlib.h> then declares the C23 type `once_flag' (bits/types/once_flag.h),
+# which collides with tinycthread.h's C11 emulation macros (`once_flag' and
+# `ONCE_FLAG_INIT') because tinycthread.c includes <stdlib.h> after
+# tinycthread.h.  Compile the C sources as C17, as gcc 14 and earlier did,
+# so the header mapping stays valid.  Only C compilation is affected;
+# C++ sources keep the -std=gnu++17 set by R.
+PKG_CFLAGS = -std=gnu17
+
 #### Debugging flags ####
 # Uncomment to enable thread assertions
 # PKG_CPPFLAGS += -DDEBUG_THREAD -UNDEBUG
