Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/compiler/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ use self::ArgData::*;

const ARCH_FLAG: &str = "-arch";

// Mostly taken from https://github.com/ccache/ccache/blob/master/src/compopt.cpp#L52-L172
// Mostly taken from https://github.com/ccache/ccache/blob/master/src/ccache/compopt.cpp#L52-L183
counted_array!(pub static ARGS: [ArgInfo<ArgData>; _] = [
flag!("-", TooHardFlag),
flag!("--coverage", Coverage),
Expand Down Expand Up @@ -242,6 +242,7 @@ counted_array!(pub static ARGS: [ArgInfo<ArgData>; _] = [
take_arg!("-o", PathBuf, CanBeSeparated, Output),
flag!("-pedantic", PedanticFlag),
flag!("-pedantic-errors", PedanticFlag),
flag!("-pipe", UnhashedFlag),
flag!("-remap", PreprocessorArgumentFlag),
flag!("-save-temps", TooHardFlag),
take_arg!("-std", OsString, Concatenated(b'='), Standard),
Expand Down Expand Up @@ -1477,6 +1478,25 @@ mod test {
assert!(!msvc_show_includes);
}

#[test]
fn test_parse_arguments_unhashed() {
let unhashed_flags = stringvec!["-pipe"];

for flag in unhashed_flags {
let args = stringvec!["-c", "foo.c", "-o", "foo.o", flag];

let a = match parse_arguments_(args, false) {
CompilerArguments::Ok(args) => args,
o => panic!("Got unexpected parse result: {:?} for flag: {:?}", o, flag),
};

assert_eq!(Language::C, a.language);
assert!(a.preprocessor_args.is_empty());
assert!(a.common_args.is_empty());
assert_eq!(ovec![flag], a.unhashed_args,);
}
}

#[test]
fn test_parse_arguments_double_dash() {
let args = stringvec!["-c", "-o", "foo.o", "--", "foo.c"];
Expand Down
Loading