-
Notifications
You must be signed in to change notification settings - Fork 747
lib: Return error early if there are any error diagnostics. #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,6 +509,25 @@ impl<'ctx> Bindings<'ctx> { | |
-> Result<Bindings<'ctx>, ()> { | ||
let span = span.unwrap_or(DUMMY_SP); | ||
|
||
// TODO: Make this path fixup configurable? | ||
if let Some(clang) = clang_sys::support::Clang::find(None) { | ||
// If --target is specified, assume caller knows what they're doing | ||
// and don't mess with include paths for them | ||
let has_target_arg = options.clang_args.iter() | ||
.rposition(|arg| arg.starts_with("--target")) | ||
.is_some(); | ||
if !has_target_arg { | ||
// TODO: distinguish C and C++ paths? C++'s should be enough, I | ||
// guess. | ||
for path in clang.cpp_search_paths.into_iter() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I start wondering (again) why do we need this fixup. What would happen if we don't have it? It doesn't seem to me it would fail to build without this on macOS (since I can run stylo bindgen with My guess is that the user of this library should always specify things they need, e.g. Also, other than The recent example of bustage with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest we remove this hacky fixup and do a breaking version bump, then teach users to add what they need themselves. |
||
if let Ok(path) = path.into_os_string().into_string() { | ||
options.clang_args.push("-isystem".to_owned()); | ||
options.clang_args.push(path); | ||
} | ||
} | ||
} | ||
} | ||
|
||
if let Some(h) = options.input_header.as_ref() { | ||
options.clang_args.push(h.clone()) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably you can move the
has_target_arg
to wrap theClang::find
block, so that it is somehow configurable?