Skip to content

Follow standard for opaque types in case of SEXPREC #205

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

Closed
wants to merge 7 commits into from
Closed
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
62 changes: 54 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,60 @@ jobs:
name: generated_binding-${{ matrix.config.os }}-R-${{ matrix.config.r }}-rust-${{ matrix.config.rust-version }}-${{ matrix.config.target || 'default'}}
path: generated_bindings

# Run tests again using different bindings
- name: Run tests on precomputed bindings shipped with libR-sys
if: matrix.config.skip-tests != 'true'
run: |
. ./ci-cargo.ps1
ci-cargo test -vv $(if ($env:RUST_TARGET -ne '') {"--target=$env:RUST_TARGET"} ) '--' --nocapture -ActionName "Running tests for target: $env:RUST_TARGET"
env:
RUST_TARGET: ${{ matrix.config.target }}
# # Run tests again using different bindings
# - name: Run tests on precomputed bindings shipped with libR-sys
# if: matrix.config.skip-tests != 'true'
# run: |
# . ./ci-cargo.ps1
# ci-cargo test -vv $(if ($env:RUST_TARGET -ne '') {"--target=$env:RUST_TARGET"} ) '--' --nocapture -ActionName "Running tests for target: $env:RUST_TARGET"
# env:
# RUST_TARGET: ${{ matrix.config.target }}
check_generate_bindings_flag:
name: Check if [generate bindings] is in latest commit message
runs-on: ubuntu-latest
outputs:
head_commit_message: ${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}
generate_bindings: ${{ contains(steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE, '[generate bindings]') }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get Head Commit Message
id: get_head_commit_message
run: echo "HEAD_COMMIT_MESSAGE=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"

pr_generated_bindings:
name: Make PR with generated bindings
needs: [test_with_bindgen, check_generate_bindings_flag]
if: needs.check_generate_bindings_flag.outputs.generate_bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions/download-artifact@v3

- name: Update bindings
run: |
# Update or add the bindings
cp generated_binding-*/*.rs bindings/

# Replace the default bindings
cd bindings
for x in linux-aarch64 linux-x86_64 macos-aarch64 macos-x86_64 windows-x86_64; do
# Choose the newest version except for devel
ln --force -s "$(ls -1 ./bindings-${x}-*.rs | grep -v devel | sort | tail -1)" ./bindings-${x}.rs
done
cd ..
- name: Add generated bindings
run: |
git add bindings/
git config --local user.name "${GITHUB_ACTOR}"
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git commit -m "Update bindings [skip ci]"
- name: Push to PR branch
run: git push

# Gather the generated bindings and push them to generated_bindings branch.
# If we need to update the bindings, create a pull request from that branch.
Expand Down
14 changes: 14 additions & 0 deletions MAINTAINERS_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# GUIDE

## 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.

## Precomputed bindings

### How to update the precomputed bindings?
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
9 changes: 2 additions & 7 deletions bindings/bindings-linux-aarch64-R4.4-devel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ pub const R_MINOR: &[u8; 4] = b"4.0\0";
pub const R_STATUS: &[u8; 29] = b"Under development (unstable)\0";
pub const R_YEAR: &[u8; 5] = b"2023\0";
pub const R_MONTH: &[u8; 3] = b"11\0";
pub const R_DAY: &[u8; 3] = b"11\0";
pub const R_SVN_REVISION: u32 = 85510;
pub const R_DAY: &[u8; 3] = b"14\0";
pub const R_SVN_REVISION: u32 = 85524;
pub const R_GE_definitions: u32 = 13;
pub const R_GE_deviceClip: u32 = 14;
pub const R_GE_group: u32 = 15;
Expand Down 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
9 changes: 2 additions & 7 deletions bindings/bindings-linux-x86_64-R4.4-devel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ pub const R_MINOR: &[u8; 4] = b"4.0\0";
pub const R_STATUS: &[u8; 29] = b"Under development (unstable)\0";
pub const R_YEAR: &[u8; 5] = b"2023\0";
pub const R_MONTH: &[u8; 3] = b"11\0";
pub const R_DAY: &[u8; 3] = b"11\0";
pub const R_SVN_REVISION: u32 = 85510;
pub const R_DAY: &[u8; 3] = b"14\0";
pub const R_SVN_REVISION: u32 = 85524;
pub const R_GE_definitions: u32 = 13;
pub const R_GE_deviceClip: u32 = 14;
pub const R_GE_group: u32 = 15;
Expand Down 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
Loading