Skip to content
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

(c2rust-analyze) Add known_fns! for declaring the permissions on ptrs in known (i.e. libc) UnknownDef fns #978

Merged
merged 10 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions c2rust-analyze/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env_logger = "0.10.0"
log = "0.4.17"
backtrace = "0.3.67"
itertools = "0.10"
libc = "0.2.147"

[build-dependencies]
c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" }
Expand Down
11 changes: 11 additions & 0 deletions c2rust-analyze/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ impl PermissionSet {
//
// `.union` is used here since it's a `const fn`, unlike `BitOr::bitor`.
pub const STRING_LITERAL: Self = Self::READ.union(Self::OFFSET_ADD);

#[cfg(test)]
pub const fn union_all<const N: usize>(a: [Self; N]) -> Self {
let mut this = Self::empty();
let mut i = 0;
while i < N {
this = this.union(a[i]);
i += 1;
}
this
spernsteiner marked this conversation as resolved.
Show resolved Hide resolved
}
}

bitflags! {
Expand Down
Loading