Skip to content

Improve comments and docs relating to char16_t. #3137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindgen/codegen/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub(crate) mod ast_ty {
// argument is used. bindgen_cchar16_t is not a real type;
// but this allows downstream postprocessors to distinguish
// this case and do something special for C++ bindings
// containing char16_t.
// containing the C++ type char16_t.
IntKind::Char16 => syn::parse_quote! { bindgen_cchar16_t },
IntKind::SChar => raw_type(ctx, "c_schar"),
IntKind::UChar => raw_type(ctx, "c_uchar"),
Expand Down
2 changes: 1 addition & 1 deletion bindgen/ir/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub enum IntKind {
/// A 16-bit integer, used only for enum size representation.
U16,

/// Either a `char16_t` or a `wchar_t`.
/// The C++ type `char16_t`, which is its own type (unlike in C).
Char16,

/// A 32-bit signed integer.
Expand Down
9 changes: 6 additions & 3 deletions bindgen/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,13 @@ macro_rules! options {
}

options! {
/// Whether we should distinguish between 'char16_t' and 'u16'.
/// As standard, bindgen represents `char16_t` as `u16`.
/// Whether we should distinguish between C++'s 'char16_t' and 'u16'.
/// The C++ type `char16_t` is its own special type; it's not a typedef
/// of some other integer (this differs from C).
/// As standard, bindgen represents C++ `char16_t` as `u16`.
/// Rust does not have a `std::os::raw::c_char16_t` type, and thus
/// we can't use a built-in Rust type in the generated bindings.
/// we can't use a built-in Rust type in the generated bindings (and
/// nor would it be appropriate as it's a C++-specific type.)
/// But for some uses of bindgen, especially when downstream
/// post-processing occurs, it's important to distinguish `char16_t`
/// from normal `uint16_t`. When this option is enabled, bindgen
Expand Down
Loading