|
|
@ -662,8 +662,15 @@ impl Config { |
|
|
|
/// This is only relevant for C and C++ files.
|
|
|
|
///
|
|
|
|
/// # Panics
|
|
|
|
/// Panics if more than one file is present in the config, or if compiler
|
|
|
|
/// path has an invalid file name.
|
|
|
|
///
|
|
|
|
/// Panics if compiler path has an invalid file name.
|
|
|
|
/// # Example
|
|
|
|
/// ```no_run
|
|
|
|
/// let out = gcc::Config::new()
|
|
|
|
/// .file("src/foo.c")
|
|
|
|
/// .expand();
|
|
|
|
/// ```
|
|
|
|
pub fn expand(&self) -> Vec<u8> { |
|
|
|
let compiler = self.get_compiler(); |
|
|
|
let mut cmd = compiler.to_command(); |
|
|
@ -671,6 +678,10 @@ impl Config { |
|
|
|
cmd.env(a, b); |
|
|
|
} |
|
|
|
cmd.arg(compiler.family.expand_flag()); |
|
|
|
|
|
|
|
assert!(self.files.len() <= 1, |
|
|
|
"Expand may only be called for a single file"); |
|
|
|
|
|
|
|
for file in self.files.iter() { |
|
|
|
cmd.arg(file); |
|
|
|
} |
|
|
|