Skip to content

Commit 24624cd

Browse files
AJIOBsylvestre
authored andcommitted
Add GCC pipe flag support
1 parent 5373c83 commit 24624cd

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/compiler/gcc.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ use self::ArgData::*;
172172

173173
const ARCH_FLAG: &str = "-arch";
174174

175-
// Mostly taken from https://github.com/ccache/ccache/blob/master/src/compopt.cpp#L52-L172
175+
// Mostly taken from https://github.com/ccache/ccache/blob/master/src/ccache/compopt.cpp#L52-L183
176176
counted_array!(pub static ARGS: [ArgInfo<ArgData>; _] = [
177177
flag!("-", TooHardFlag),
178178
flag!("--coverage", Coverage),
@@ -244,6 +244,7 @@ counted_array!(pub static ARGS: [ArgInfo<ArgData>; _] = [
244244
take_arg!("-o", PathBuf, CanBeSeparated, Output),
245245
flag!("-pedantic", PedanticFlag),
246246
flag!("-pedantic-errors", PedanticFlag),
247+
flag!("-pipe", UnhashedFlag),
247248
flag!("-remap", PreprocessorArgumentFlag),
248249
flag!("-save-temps", TooHardFlag),
249250
flag!("-save-temps=cwd", TooHardFlag),
@@ -1481,6 +1482,25 @@ mod test {
14811482
assert!(!msvc_show_includes);
14821483
}
14831484

1485+
#[test]
1486+
fn test_parse_arguments_unhashed() {
1487+
let unhashed_flags = stringvec!["-pipe"];
1488+
1489+
for flag in unhashed_flags {
1490+
let args = stringvec!["-c", "foo.c", "-o", "foo.o", flag];
1491+
1492+
let a = match parse_arguments_(args, false) {
1493+
CompilerArguments::Ok(args) => args,
1494+
o => panic!("Got unexpected parse result: {:?} for flag: {:?}", o, flag),
1495+
};
1496+
1497+
assert_eq!(Language::C, a.language);
1498+
assert!(a.preprocessor_args.is_empty());
1499+
assert!(a.common_args.is_empty());
1500+
assert_eq!(ovec![flag], a.unhashed_args,);
1501+
}
1502+
}
1503+
14841504
#[test]
14851505
fn test_parse_arguments_double_dash() {
14861506
let args = stringvec!["-c", "-o", "foo.o", "--", "foo.c"];

0 commit comments

Comments
 (0)