Merge branch 'pthread-def' into 'master'

Fix pthread init and null for C++

See merge request redox-os/relibc!1408
This commit is contained in:
Jeremy Soller
2026-06-03 18:57:24 -06:00
10 changed files with 78 additions and 8 deletions
+7
View File
@@ -9,3 +9,10 @@
include_guard = "_RELIBC_BITS_NULL_T_H"
language = "C"
no_includes = true
after_includes = """
#ifdef __cplusplus
#define NULL nullptr
#else
#define NULL ((void *)0)
#endif
"""
+1 -4
View File
@@ -1,4 +1 @@
use crate::platform::types::c_long;
/// Null pointer constant.
pub const NULL: c_long = 0;
// NULL is defined in cbindgen
+3 -3
View File
@@ -6,10 +6,10 @@ no_includes = true
cpp_compat = true
# TODO: Any better way to implement pthread_cleanup_push/pthread_cleanup_pop?
after_includes = """
#define PTHREAD_COND_INITIALIZER ((pthread_cond_t){0})
#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t){0})
#define PTHREAD_COND_INITIALIZER {0}
#define PTHREAD_MUTEX_INITIALIZER {0}
#define PTHREAD_RWLOCK_INITIALIZER {0}
#define PTHREAD_ONCE_INIT ((pthread_once_t){0})
#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t){0})
#define pthread_cleanup_push(ROUTINE, ARG) do { \\
struct { \\
+2
View File
@@ -15,7 +15,9 @@ after_includes = """
#include <bits/timespec.h> // for timespec
#include <bits/pthread.h> // for pthread-related types
#ifndef __cplusplus
#define thread_local _Thread_local
#endif
#define ONCE_FLAG_INIT PTHREAD_ONCE_INIT // once_flag == pthread_once_t
"""