Skip to content

Replace SEXPREC with something truly opaque #212

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 7 commits into from
Apr 21, 2024
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
14 changes: 14 additions & 0 deletions MAINTAINERS_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

## Commit newly generated bindings

You last commit must contain `[generate bindings]`. You can make an empty
commit with this message:

```sh
git commit -m "[generate bindings]" --allow-empty
```

Then after successfully running workflows, GitHub Actions will push a commit
with the updated bindings onto your PR branch.

# GUIDE

## Commit newly generated bindings

Your last commit must contain `[generate bindings]`. You can make an empty
commit with this message:

Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-linux-aarch64-R4.2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-linux-aarch64-R4.3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-linux-aarch64-R4.4-devel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-linux-x86_64-R4.2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-linux-x86_64-R4.3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-linux-x86_64-R4.4-devel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-macos-aarch64-R4.3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-macos-x86_64-R4.2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-macos-x86_64-R4.3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
9 changes: 2 additions & 7 deletions bindings/bindings-macos-x86_64-R4.4-devel.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* automatically generated by rust-bindgen 0.69.1 */

/* libR-sys version: 0.6.0 */
/* bindgen clang version: Homebrew clang version 17.0.2 */
/* clang-rs version: Homebrew clang version 17.0.2 */
/* bindgen clang version: Homebrew clang version 17.0.3 */
/* clang-rs version: Homebrew clang version 17.0.3 */
/* r version: 4.4.0-devel */

#[repr(C)]
Expand Down Expand Up @@ -351,11 +351,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-windows-x86_64-R4.2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-windows-x86_64-R4.3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
5 changes: 0 additions & 5 deletions bindings/bindings-windows-x86_64-R4.4-devel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ pub type Rbyte = ::std::os::raw::c_uchar;
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SEXPREC {
_unused: [u8; 0],
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ fn generate_bindings(r_paths: &InstallationPaths, version_info: &RVersionInfo) {
// Remove all Fortran items, these are items with underscore _ postfix
let bindgen_builder = bindgen_builder.blocklist_item("[A-Za-z_][A-Za-z0-9_]*[^_]_$");

// Ensure that `SEXPREC` is opaque to Rust
let bindgen_builder = bindgen_builder.blocklist_item("SEXPREC");

// Finish the builder and generate the bindings.
let bindings = bindgen_builder
.raw_line(format!(
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

#[non_exhaustive]
#[repr(transparent)]
#[derive(Debug)]
pub struct SEXPREC(std::ffi::c_void);

#[cfg(test)]
mod tests {
use super::*;
Expand Down