string.h: don't pollute the namespace with locale.h

Previously, we included all of `<locale.h>` in order to get `locale_t`.
This commit separates it into a `<bits/locale-t.h>` header (generated by
cbindgen) to better deal with this.
This commit is contained in:
Connor-GH
2026-01-20 14:29:08 -06:00
parent 3362ca356a
commit cedd1686ba
7 changed files with 26 additions and 3 deletions
+14
View File
@@ -0,0 +1,14 @@
sys_includes = []
include_guard = "_RELIBC_BITS_LOCALE_T_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
[export]
include = [
"locale_t"
]
[enum]
prefix_with_name = true
+1
View File
@@ -0,0 +1 @@
pub type locale_t = *mut core::ffi::c_void;
+3
View File
@@ -1,4 +1,7 @@
include_guard = "_RELIBC_LOCALE_H"
after_includes = """
#include <bits/locale-t.h> // for locale_t
"""
trailer = "#include <bits/locale.h>"
language = "C"
style = "Tag"
+1 -1
View File
@@ -27,7 +27,7 @@ use constants::*;
mod data;
use data::*;
pub type locale_t = *mut c_void;
use super::bits_locale_t::locale_t;
/// constant struct to "C" or "POSIX" locale
/// mutable because POSIX demands a mutable pointer
static mut POSIX_LOCALE: lconv = posix_lconv();
+2
View File
@@ -4,6 +4,8 @@ pub mod _aio;
pub mod _fenv;
pub mod arpa_inet;
pub mod assert;
#[path = "bits_locale-t/mod.rs"]
pub mod bits_locale_t;
pub mod bits_pthread;
pub mod bits_sched;
// complex.h implemented in C
+4 -1
View File
@@ -1,5 +1,8 @@
sys_includes = ["stddef.h", "stdint.h", "strings.h", "locale.h"]
sys_includes = ["stddef.h", "stdint.h", "strings.h"]
include_guard = "_RELIBC_STRING_H"
after_includes = """
#include <bits/locale-t.h> // for locale_t
"""
language = "C"
style = "Tag"
no_includes = true
+1 -1
View File
@@ -20,7 +20,7 @@ use crate::{
raw_cell::RawCell,
};
use super::locale::{THREAD_LOCALE, locale_t};
use super::{bits_locale_t::locale_t, locale::THREAD_LOCALE};
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/memccpy.html>.
///