@@ -125,20 +125,6 @@ pub fn builder() -> Builder {
125
125
pub fn builder_from_flags < I > ( args : I ) -> Result < Builder , io:: Error >
126
126
where I : Iterator < Item =String >
127
127
{
128
- // clap doesn't support the end of options marker, --
129
- // https://github.com/kbknapp/clap-rs/issues/735
130
- let mut terminated = false ;
131
- let ( bindgen_args, clang_args) : ( Vec < _ > , Vec < _ > ) = args. partition ( |arg| {
132
- if terminated { // clang arg
133
- false
134
- } else if arg == "--" {
135
- terminated = true ; // end of bindgen args, start of clang args
136
- false
137
- } else { // bindgen arg
138
- true
139
- }
140
- } ) ;
141
-
142
128
let matches = App :: new ( "bindgen" )
143
129
. version ( env ! ( "CARGO_PKG_VERSION" ) )
144
130
. about ( "Generates Rust bindings from C/C++ headers." )
@@ -167,6 +153,8 @@ pub fn builder_from_flags<I>(args: I) -> Result<Builder, io::Error>
167
153
. help ( "Use the given prefix before raw types instead of ::std::os::raw." )
168
154
. value_name ( "prefix" )
169
155
. takes_value ( true ) ,
156
+ Arg :: with_name ( "clang-args" )
157
+ . multiple ( true ) ,
170
158
Arg :: with_name ( "dummy-uses" )
171
159
. long ( "dummy-uses" )
172
160
. help ( "For testing purposes, generate a C/C++ file containing dummy uses of all types defined in the input header." )
@@ -243,7 +231,7 @@ pub fn builder_from_flags<I>(args: I) -> Result<Builder, io::Error>
243
231
. takes_value ( true )
244
232
. multiple ( true ) ,
245
233
] ) // .args()
246
- . get_matches_from ( bindgen_args ) ;
234
+ . get_matches_from ( args ) ;
247
235
248
236
let mut builder = builder ( ) ;
249
237
@@ -349,8 +337,10 @@ pub fn builder_from_flags<I>(args: I) -> Result<Builder, io::Error>
349
337
}
350
338
}
351
339
352
- for arg in clang_args. into_iter ( ) . skip ( 1 ) {
353
- builder = builder. clang_arg ( arg) ;
340
+ if let Some ( args) = matches. values_of ( "clang-args" ) {
341
+ for arg in args {
342
+ builder = builder. clang_arg ( arg) ;
343
+ }
354
344
}
355
345
356
346
// FIXME: hrrrmmm
0 commit comments