File tree Expand file tree Collapse file tree
extensions/bindgen/private Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -271,7 +271,8 @@ def _rust_bindgen_impl(ctx):
271271 # Ideally we could depend on a more specific toolchain, requesting one which is specifically clang via some constraint.
272272 # Unfortunately, we can't currently rely on this, so instead we filter only to flags we know clang supports.
273273 # We can add extra flags here as needed.
274- flags_known_to_clang = (
274+ # Flags in this tuple accept a parameter in the same argument (`-Ipath`, `--target=T`) or separately (`-I path`).
275+ param_flags_known_to_clang = (
275276 "-I" ,
276277 "-iquote" ,
277278 "-isystem" ,
@@ -283,8 +284,16 @@ def _rust_bindgen_impl(ctx):
283284 "--no-system-header-prefix" ,
284285 "-Xclang" ,
285286 "-D" ,
287+ )
288+
289+ # Flags in this tuple do not accept a parameter.
290+ paramless_flags_known_to_clang = (
286291 "-no-canonical-prefixes" ,
287- "-nostd" ,
292+ "-nostdinc" ,
293+ "--no-standard-includes" ,
294+ "-nostdinc++" ,
295+ "-nostdlib++" ,
296+ "-nostdlibinc" ,
288297 )
289298 open_arg = False
290299 for arg in compile_flags :
@@ -298,12 +307,12 @@ def _rust_bindgen_impl(ctx):
298307 args .add (arg )
299308 continue
300309
301- if not arg .startswith (flags_known_to_clang ) :
310+ if not arg .startswith (param_flags_known_to_clang ) and not arg in paramless_flags_known_to_clang :
302311 continue
303312
304313 args .add (arg )
305314
306- if arg in flags_known_to_clang :
315+ if arg in param_flags_known_to_clang :
307316 open_arg = True
308317 continue
309318
You can’t perform that action at this time.
0 commit comments