{"action":"created","issue":{"url":"https://api.github.com/repos/crabtw/rust-bindgen/issues/368","repository_url":"https://api.github.com/repos/crabtw/rust-bindgen","labels_url":"https://api.github.com/repos/crabtw/rust-bindgen/issues/368/labels{/name}","comments_url":"https://api.github.com/repos/crabtw/rust-bindgen/issues/368/comments","events_url":"https://api.github.com/repos/crabtw/rust-bindgen/issues/368/events","html_url":"https://github.com/crabtw/rust-bindgen/pull/368","id":165230657,"number":368,"title":"Add option to not write attributes to the generate module","user":{"login":"Twinklebear","id":1522476,"avatar_url":"https://avatars.githubusercontent.com/u/1522476?v=3","gravatar_id":"","url":"https://api.github.com/users/Twinklebear","html_url":"https://github.com/Twinklebear","followers_url":"https://api.github.com/users/Twinklebear/followers","following_url":"https://api.github.com/users/Twinklebear/following{/other_user}","gists_url":"https://api.github.com/users/Twinklebear/gists{/gist_id}","starred_url":"https://api.github.com/users/Twinklebear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Twinklebear/subscriptions","organizations_url":"https://api.github.com/users/Twinklebear/orgs","repos_url":"https://api.github.com/users/Twinklebear/repos","events_url":"https://api.github.com/users/Twinklebear/events{/privacy}","received_events_url":"https://api.github.com/users/Twinklebear/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-13T03:37:56Z","updated_at":"2016-07-14T08:10:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/crabtw/rust-bindgen/pulls/368","html_url":"https://github.com/crabtw/rust-bindgen/pull/368","diff_url":"https://github.com/crabtw/rust-bindgen/pull/368.diff","patch_url":"https://github.com/crabtw/rust-bindgen/pull/368.patch"},"body":"As mentioned in #359 defaulting to writing the `#[allow(...)]` attributes at the top of the module makes it so that the code can't be compiled into existing modules via `include!` making it hard to use bindgen for build scripts that compile some native library and generate bindings for it which are then included via:\r\n\r\n```rust\r\ninclude!(concat!(env!(\"OUT_DIR\"), \"/\", \"libname_bindings.rs\"));\r\n```\r\n\r\nI think having the attributes set by default makes sense but for using bindgen in a build script, where you'd set the attributes yourself above the include, having no way to disable them makes it a pain. I'm not sure if there's other stuff that would make sense here, it could be included as a regular Rust module but I don't think a build script should write to `src/` and `include!` seems to be the recommended way to do it in the Cargo guide on build scripts.\r\n\r\nLet me know what you think, I would find it extremely useful for my own project [ispc-rs](https://github.com/Twinklebear/ispc-rs), without this option I'm basically stuck on 0.17.0 or must resort to patching the bindgen generated modules afterwards.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/crabtw/rust-bindgen/368)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/crabtw/rust-bindgen/issues/comments/232593642","html_url":"https://github.com/crabtw/rust-bindgen/pull/368#issuecomment-232593642","issue_url":"https://api.github.com/repos/crabtw/rust-bindgen/issues/368","id":232593642,"user":{"login":"Yamakaky","id":1327378,"avatar_url":"https://avatars.githubusercontent.com/u/1327378?v=3","gravatar_id":"","url":"https://api.github.com/users/Yamakaky","html_url":"https://github.com/Yamakaky","followers_url":"https://api.github.com/users/Yamakaky/followers","following_url":"https://api.github.com/users/Yamakaky/following{/other_user}","gists_url":"https://api.github.com/users/Yamakaky/gists{/gist_id}","starred_url":"https://api.github.com/users/Yamakaky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yamakaky/subscriptions","organizations_url":"https://api.github.com/users/Yamakaky/orgs","repos_url":"https://api.github.com/users/Yamakaky/repos","events_url":"https://api.github.com/users/Yamakaky/events{/privacy}","received_events_url":"https://api.github.com/users/Yamakaky/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T08:10:23Z","updated_at":"2016-07-14T08:10:23Z","body":"In fact, did you try something like this:\r\n```rust\r\nmod ffi {\r\n    include!(concat!(env!(\"OUT_DIR\"), \"/\", \"libname_bindings.rs\"));\r\n}\r\n```"}}
{"actor":{"display_login":"Yamakaky"}}