Skip to content

Commit 939073a

Browse files
committed
Add GCC pipe flag support
1 parent 760a109 commit 939073a

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),
@@ -242,6 +242,7 @@ counted_array!(pub static ARGS: [ArgInfo<ArgData>; _] = [
242242
take_arg!("-o", PathBuf, CanBeSeparated, Output),
243243
flag!("-pedantic", PedanticFlag),
244244
flag!("-pedantic-errors", PedanticFlag),
245+
flag!("-pipe", UnhashedFlag),
245246
flag!("-remap", PreprocessorArgumentFlag),
246247
flag!("-save-temps", TooHardFlag),
247248
take_arg!("-std", OsString, Concatenated(b'='), Standard),
@@ -1477,6 +1478,25 @@ mod test {
14771478
assert!(!msvc_show_includes);
14781479
}
14791480

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

0 commit comments

Comments
 (0)