aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2019-03-26 13:38:14 +0000
committerEmilio Cobos Álvarez <emilio@crisal.io>2019-03-27 14:29:27 +0100
commitf637d93fc18a4de8bce732fb2da246d9e203de3c (patch)
tree9489c38b0946a5e24a3fa1fea656053ab36b5d19
parentecda72a5fd2ca41b1150efc2d80d89eb20f0d388 (diff)
downloadservo-f637d93fc18a4de8bce732fb2da246d9e203de3c.tar.gz
servo-f637d93fc18a4de8bce732fb2da246d9e203de3c.zip
style: Remove bindings.rs.
I kept it building the most straight-forward way possible (pub use) because it seems to me that bindings is not a bad name, and we should probably move structs.rs to be bindings.rs rather than the other way around. But that's a different bug in any case, need to think more about it. Differential Revision: https://phabricator.services.mozilla.com/D24713
-rw-r--r--components/style/build_gecko.rs39
-rw-r--r--components/style/gecko_bindings/mod.rs7
2 files changed, 7 insertions, 39 deletions
diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs
index ba53068be82..f68ac639697 100644
--- a/components/style/build_gecko.rs
+++ b/components/style/build_gecko.rs
@@ -32,7 +32,6 @@ mod bindings {
use toml::value::Table;
const STRUCTS_FILE: &'static str = "structs.rs";
- const BINDINGS_FILE: &'static str = "bindings.rs";
fn read_config(path: &PathBuf) -> Table {
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
@@ -295,10 +294,11 @@ mod bindings {
fn generate_structs() {
let builder = Builder::get_initial_builder()
.enable_cxx_namespaces()
- .with_codegen_config(CodegenConfig::TYPES | CodegenConfig::VARS);
+ .with_codegen_config(CodegenConfig::TYPES | CodegenConfig::VARS | CodegenConfig::FUNCTIONS);
let mut fixups = vec![];
let builder = BuilderWithConfig::new(builder, CONFIG["structs"].as_table().unwrap())
.handle_common(&mut fixups)
+ .handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
.handle_str_items("bitfield-enums", |b, item| b.bitfield_enum(item))
.handle_str_items("rusty-enums", |b, item| b.rustified_enum(item))
.handle_str_items("whitelist-vars", |b, item| b.whitelist_var(item))
@@ -389,20 +389,6 @@ mod bindings {
}
}
- // FIXME(emilio): Avoid this altogether.
- fn generate_bindings() {
- let builder = Builder::get_initial_builder()
- .disable_name_namespacing()
- .with_codegen_config(CodegenConfig::FUNCTIONS);
- let config = CONFIG["bindings"].as_table().unwrap();
- let mut fixups = vec![];
- let builder = BuilderWithConfig::new(builder, config)
- .handle_common(&mut fixups)
- .handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
- .get_builder();
- write_binding_file(builder, BINDINGS_FILE, &fixups);
- }
-
fn generate_atoms() {
let script = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap())
.join("gecko")
@@ -420,24 +406,9 @@ mod bindings {
}
pub fn generate() {
- use std::thread;
- macro_rules! run_tasks {
- ($($task:expr,)+) => {
- if setup_logging() {
- $($task;)+
- } else {
- let threads = vec![$( thread::spawn(|| $task) ),+];
- for thread in threads.into_iter() {
- thread.join().unwrap();
- }
- }
- }
- }
- run_tasks! {
- generate_structs(),
- generate_bindings(),
- generate_atoms(),
- }
+ setup_logging();
+ generate_structs();
+ generate_atoms();
for path in ADDED_PATHS.lock().unwrap().iter() {
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
diff --git a/components/style/gecko_bindings/mod.rs b/components/style/gecko_bindings/mod.rs
index 78fc8e3ae76..87f444f5a91 100644
--- a/components/style/gecko_bindings/mod.rs
+++ b/components/style/gecko_bindings/mod.rs
@@ -4,11 +4,6 @@
//! Gecko's C++ bindings, along with some rust helpers to ease its use.
-#[allow(dead_code, improper_ctypes, non_camel_case_types, missing_docs)]
-pub mod bindings {
- include!(concat!(env!("OUT_DIR"), "/gecko/bindings.rs"));
-}
-
// FIXME: We allow `improper_ctypes` (for now), because the lint doesn't allow
// foreign structs to have `PhantomData`. We should remove this once the lint
// ignores this case.
@@ -25,4 +20,6 @@ pub mod structs {
include!(concat!(env!("OUT_DIR"), "/gecko/structs.rs"));
}
+pub use self::structs as bindings;
+
pub mod sugar;