Skip to content

Commit 845052c

Browse files
authored
Treat VxWorks wr-cc as a Gnu compiler (#1198)
1 parent 41535f6 commit 845052c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/detect_compiler_family.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
#pragma message "emscripten"
1111
#endif
1212

13+
#ifdef __VXWORKS__
14+
#pragma message "VxWorks"
15+
#endif

src/tool.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,19 @@ impl Tool {
170170
let clang = stdout.contains(r#""clang""#);
171171
let gcc = stdout.contains(r#""gcc""#);
172172
let emscripten = stdout.contains(r#""emscripten""#);
173+
let vxworks = stdout.contains(r#""VxWorks""#);
173174

174-
match (clang, accepts_cl_style_flags, gcc, emscripten) {
175-
(clang_cl, true, _, false) => Ok(ToolFamily::Msvc { clang_cl }),
176-
(true, _, _, _) | (_, _, _, true) => Ok(ToolFamily::Clang {
175+
match (clang, accepts_cl_style_flags, gcc, emscripten, vxworks) {
176+
(clang_cl, true, _, false, false) => Ok(ToolFamily::Msvc { clang_cl }),
177+
(true, _, _, _, false) | (_, _, _, true, false) => Ok(ToolFamily::Clang {
177178
zig_cc: is_zig_cc(path, cargo_output),
178179
}),
179-
(false, false, true, _) => Ok(ToolFamily::Gnu),
180-
(false, false, false, false) => {
181-
cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `__EMSCRIPTEN__`, also does not accept cl style flag `-?`, fallback to treating it as GNU");
180+
(false, false, true, _, false) | (_, _, _, _, true) => Ok(ToolFamily::Gnu),
181+
(false, false, false, false, false) => {
182+
cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__`, `__EMSCRIPTEN__` or `__VXWORKS__`, also does not accept cl style flag `-?`, fallback to treating it as GNU");
182183
Err(Error::new(
183184
ErrorKind::ToolFamilyMacroNotFound,
184-
"Expects macro `__clang__`, `__GNUC__` or `__EMSCRIPTEN__`, or accepts cl style flag `-?`, but found none",
185+
"Expects macro `__clang__`, `__GNUC__` or `__EMSCRIPTEN__`, `__VXWORKS__` or accepts cl style flag `-?`, but found none",
185186
))
186187
}
187188
}

0 commit comments

Comments
 (0)