Skip to content

Commit

Permalink
Further tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
yutannihilation committed Feb 12, 2022
1 parent 5f89940 commit e2b33b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ fn generate_bindings(r_paths: &InstallationPaths, version_info: &RVersionInfo) {
//
// #define FOO(x) (x + 1)
//
let re = regex::Regex::new(r#"^\s*#\s*define\s+([^\s\(]+)(\s*\(|\s+[0-9"])"#).unwrap();
let re = regex::Regex::new(r#"^\s*#\s*define\s+([^\s\(]+)(\s*\(|\s+-?[0-9"])"#).unwrap();

for include_file in include_files {
let file = std::fs::File::open(include_file).unwrap();
Expand All @@ -428,6 +428,10 @@ fn generate_bindings(r_paths: &InstallationPaths, version_info: &RVersionInfo) {
}
}

// Cannot detect when the #define-ed constats are aliased in another #define
// c.f. https://github.com/wch/r-source/blob/9f284035b7e503aebe4a804579e9e80a541311bb/src/include/R_ext/GraphicsEngine.h#L93
allowlist.insert("R_GE_version".to_string());

let allowlist_pattern = allowlist.into_iter().collect::<Vec<String>>().join("|");

// The bindgen::Builder is the main entry point
Expand Down

0 comments on commit e2b33b5

Please sign in to comment.