| { | ||
| "git": { | ||
| "sha1": "1881acbb3852039a8206ade2232978e73b71335f" | ||
| "sha1": "a8c9dc0187367bcecd9a59585153ff71859dd8ed" | ||
| }, | ||
| "path_in_vcs": "" | ||
| } |
+7
-7
@@ -7,9 +7,9 @@ # This file is automatically @generated by Cargo. | ||
| name = "bitflags" | ||
| version = "2.6.0" | ||
| version = "2.7.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" | ||
| checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" | ||
| [[package]] | ||
| name = "cc" | ||
| version = "1.2.7" | ||
| version = "1.2.8" | ||
| dependencies = [ | ||
@@ -72,5 +72,5 @@ "jobserver", | ||
| name = "linux-raw-sys" | ||
| version = "0.4.14" | ||
| version = "0.4.15" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" | ||
| checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" | ||
@@ -85,5 +85,5 @@ [[package]] | ||
| name = "rustix" | ||
| version = "0.38.42" | ||
| version = "0.38.43" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" | ||
| checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" | ||
| dependencies = [ | ||
@@ -90,0 +90,0 @@ "bitflags", |
+1
-1
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "cc" | ||
| version = "1.2.7" | ||
| version = "1.2.8" | ||
| authors = ["Alex Crichton <alex@alexcrichton.com>"] | ||
@@ -19,0 +19,0 @@ build = false |
+11
-0
@@ -9,2 +9,13 @@ # Changelog | ||
| ## [1.2.8](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.7...cc-v1.2.8) - 2025-01-11 | ||
| ### Other | ||
| - Add `is_like_clang_cl()` getter (#1357) | ||
| - Fix clippy error in lib.rs ([#1356](https://github.com/rust-lang/cc-rs/pull/1356)) | ||
| - Regenerate target info ([#1352](https://github.com/rust-lang/cc-rs/pull/1352)) | ||
| - Fix compiler family detection issue with clang-cl on macOS ([#1328](https://github.com/rust-lang/cc-rs/pull/1328)) | ||
| - Update `windows-bindgen` dependency ([#1347](https://github.com/rust-lang/cc-rs/pull/1347)) | ||
| - Fix clippy warnings ([#1346](https://github.com/rust-lang/cc-rs/pull/1346)) | ||
| ## [1.2.7](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.6...cc-v1.2.7) - 2025-01-03 | ||
@@ -11,0 +22,0 @@ |
+10
-10
@@ -316,3 +316,3 @@ use crate::target::TargetInfo; | ||
| let expected = RustcCodegenFlags { | ||
| code_model: Some("tiny".into()), | ||
| code_model: Some("tiny"), | ||
| ..RustcCodegenFlags::default() | ||
@@ -331,3 +331,3 @@ }; | ||
| &RustcCodegenFlags { | ||
| code_model: Some("small".into()), | ||
| code_model: Some("small"), | ||
| ..RustcCodegenFlags::default() | ||
@@ -347,3 +347,3 @@ }, | ||
| let expected = RustcCodegenFlags { | ||
| lto: Some("true".into()), | ||
| lto: Some("true"), | ||
| ..RustcCodegenFlags::default() | ||
@@ -466,16 +466,16 @@ }; | ||
| &RustcCodegenFlags { | ||
| code_model: Some("tiny".into()), | ||
| control_flow_guard: Some("yes".into()), | ||
| code_model: Some("tiny"), | ||
| control_flow_guard: Some("yes"), | ||
| embed_bitcode: Some(false), | ||
| force_frame_pointers: Some(true), | ||
| link_dead_code: Some(true), | ||
| lto: Some("false".into()), | ||
| lto: Some("false"), | ||
| no_redzone: Some(true), | ||
| no_vectorize_loops: true, | ||
| no_vectorize_slp: true, | ||
| profile_generate: Some("fooprofile".into()), | ||
| profile_use: Some("fooprofile".into()), | ||
| relocation_model: Some("pic".into()), | ||
| profile_generate: Some("fooprofile"), | ||
| profile_use: Some("fooprofile"), | ||
| relocation_model: Some("pic"), | ||
| soft_float: Some(true), | ||
| branch_protection: Some("bti,pac-ret,leaf".into()), | ||
| branch_protection: Some("bti,pac-ret,leaf"), | ||
| }, | ||
@@ -482,0 +482,0 @@ ); |
+71
-41
@@ -108,2 +108,42 @@ use std::{ | ||
| fn guess_family_from_stdout( | ||
| stdout: &str, | ||
| path: &Path, | ||
| cargo_output: &CargoOutput, | ||
| ) -> Result<ToolFamily, Error> { | ||
| cargo_output.print_debug(&stdout); | ||
| // https://gitlab.kitware.com/cmake/cmake/-/blob/69a2eeb9dff5b60f2f1e5b425002a0fd45b7cadb/Modules/CMakeDetermineCompilerId.cmake#L267-271 | ||
| // stdin is set to null to ensure that the help output is never paginated. | ||
| let accepts_cl_style_flags = | ||
| run(Command::new(path).arg("-?").stdin(Stdio::null()), path, &{ | ||
| // the errors are not errors! | ||
| let mut cargo_output = cargo_output.clone(); | ||
| cargo_output.warnings = cargo_output.debug; | ||
| cargo_output.output = OutputKind::Discard; | ||
| cargo_output | ||
| }) | ||
| .is_ok(); | ||
| let clang = stdout.contains(r#""clang""#); | ||
| let gcc = stdout.contains(r#""gcc""#); | ||
| let emscripten = stdout.contains(r#""emscripten""#); | ||
| let vxworks = stdout.contains(r#""VxWorks""#); | ||
| match (clang, accepts_cl_style_flags, gcc, emscripten, vxworks) { | ||
| (clang_cl, true, _, false, false) => Ok(ToolFamily::Msvc { clang_cl }), | ||
| (true, _, _, _, false) | (_, _, _, true, false) => Ok(ToolFamily::Clang { | ||
| zig_cc: is_zig_cc(path, cargo_output), | ||
| }), | ||
| (false, false, true, _, false) | (_, _, _, _, true) => Ok(ToolFamily::Gnu), | ||
| (false, false, false, false, false) => { | ||
| 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"); | ||
| Err(Error::new( | ||
| ErrorKind::ToolFamilyMacroNotFound, | ||
| "Expects macro `__clang__`, `__GNUC__` or `__EMSCRIPTEN__`, `__VXWORKS__` or accepts cl style flag `-?`, but found none", | ||
| )) | ||
| } | ||
| } | ||
| } | ||
| fn detect_family_inner( | ||
@@ -144,49 +184,26 @@ path: &Path, | ||
| // When expanding the file, the compiler prints a lot of information to stderr | ||
| // that it is not an error, but related to expanding itself. | ||
| // | ||
| // cc would have to disable warning here to prevent generation of too many warnings. | ||
| let mut compiler_detect_output = cargo_output.clone(); | ||
| compiler_detect_output.warnings = compiler_detect_output.debug; | ||
| let stdout = run_output( | ||
| Command::new(path).arg("-E").arg(tmp.path()), | ||
| path, | ||
| // When expanding the file, the compiler prints a lot of information to stderr | ||
| // that it is not an error, but related to expanding itself. | ||
| // | ||
| // cc would have to disable warning here to prevent generation of too many warnings. | ||
| &{ | ||
| let mut cargo_output = cargo_output.clone(); | ||
| cargo_output.warnings = cargo_output.debug; | ||
| cargo_output | ||
| }, | ||
| &compiler_detect_output, | ||
| )?; | ||
| let stdout = String::from_utf8_lossy(&stdout); | ||
| cargo_output.print_debug(&stdout); | ||
| // https://gitlab.kitware.com/cmake/cmake/-/blob/69a2eeb9dff5b60f2f1e5b425002a0fd45b7cadb/Modules/CMakeDetermineCompilerId.cmake#L267-271 | ||
| // stdin is set to null to ensure that the help output is never paginated. | ||
| let accepts_cl_style_flags = | ||
| run(Command::new(path).arg("-?").stdin(Stdio::null()), path, &{ | ||
| // the errors are not errors! | ||
| let mut cargo_output = cargo_output.clone(); | ||
| cargo_output.warnings = cargo_output.debug; | ||
| cargo_output.output = OutputKind::Discard; | ||
| cargo_output | ||
| }) | ||
| .is_ok(); | ||
| let clang = stdout.contains(r#""clang""#); | ||
| let gcc = stdout.contains(r#""gcc""#); | ||
| let emscripten = stdout.contains(r#""emscripten""#); | ||
| let vxworks = stdout.contains(r#""VxWorks""#); | ||
| match (clang, accepts_cl_style_flags, gcc, emscripten, vxworks) { | ||
| (clang_cl, true, _, false, false) => Ok(ToolFamily::Msvc { clang_cl }), | ||
| (true, _, _, _, false) | (_, _, _, true, false) => Ok(ToolFamily::Clang { | ||
| zig_cc: is_zig_cc(path, cargo_output), | ||
| }), | ||
| (false, false, true, _, false) | (_, _, _, _, true) => Ok(ToolFamily::Gnu), | ||
| (false, false, false, false, false) => { | ||
| 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"); | ||
| Err(Error::new( | ||
| ErrorKind::ToolFamilyMacroNotFound, | ||
| "Expects macro `__clang__`, `__GNUC__` or `__EMSCRIPTEN__`, `__VXWORKS__` or accepts cl style flag `-?`, but found none", | ||
| )) | ||
| } | ||
| if stdout.contains("-Wslash-u-filename") { | ||
| let stdout = run_output( | ||
| Command::new(path).arg("-E").arg("--").arg(tmp.path()), | ||
| path, | ||
| &compiler_detect_output, | ||
| )?; | ||
| let stdout = String::from_utf8_lossy(&stdout); | ||
| guess_family_from_stdout(&stdout, path, cargo_output) | ||
| } else { | ||
| guess_family_from_stdout(&stdout, path, cargo_output) | ||
| } | ||
@@ -408,2 +425,15 @@ } | ||
| } | ||
| /// Whether the tool is `clang-cl`-based MSVC-like. | ||
| pub fn is_like_clang_cl(&self) -> bool { | ||
| matches!(self.family, ToolFamily::Msvc { clang_cl: true }) | ||
| } | ||
| /// Supports using `--` delimiter to separate arguments and path to source files. | ||
| pub(crate) fn supports_path_delimiter(&self) -> bool { | ||
| matches!( | ||
| self.family, | ||
| ToolFamily::Clang { .. } | ToolFamily::Msvc { clang_cl: true } | ||
| ) && !self.cuda | ||
| } | ||
| } | ||
@@ -410,0 +440,0 @@ |
@@ -9,3 +9,3 @@ // This file is autogenerated. | ||
| // ``` | ||
| // Bindings generated by `windows-bindgen` 0.58.0 | ||
| // Bindings generated by `windows-bindgen` 0.59.0 | ||
@@ -19,6 +19,5 @@ #![allow( | ||
| )] | ||
| windows_targets::link!("advapi32.dll" "system" fn RegCloseKey(hkey : HKEY) -> WIN32_ERROR); | ||
| windows_targets::link!("advapi32.dll" "system" fn RegEnumKeyExW(hkey : HKEY, dwindex : u32, lpname : PWSTR, lpcchname : *mut u32, lpreserved : *const u32, lpclass : PWSTR, lpcchclass : *mut u32, lpftlastwritetime : *mut FILETIME) -> WIN32_ERROR); | ||
| windows_targets::link!("advapi32.dll" "system" fn RegOpenKeyExW(hkey : HKEY, lpsubkey : PCWSTR, uloptions : u32, samdesired : REG_SAM_FLAGS, phkresult : *mut HKEY) -> WIN32_ERROR); | ||
| windows_targets::link!("advapi32.dll" "system" fn RegQueryValueExW(hkey : HKEY, lpvaluename : PCWSTR, lpreserved : *const u32, lptype : *mut REG_VALUE_TYPE, lpdata : *mut u8, lpcbdata : *mut u32) -> WIN32_ERROR); | ||
| windows_targets::link!("ole32.dll" "system" fn CoCreateInstance(rclsid : *const GUID, punkouter : * mut core::ffi::c_void, dwclscontext : CLSCTX, riid : *const GUID, ppv : *mut *mut core::ffi::c_void) -> HRESULT); | ||
| windows_targets::link!("ole32.dll" "system" fn CoInitializeEx(pvreserved : *const core::ffi::c_void, dwcoinit : u32) -> HRESULT); | ||
| windows_targets::link!("kernel32.dll" "system" fn FreeLibrary(hlibmodule : HMODULE) -> BOOL); | ||
@@ -30,8 +29,10 @@ windows_targets::link!("kernel32.dll" "system" fn GetMachineTypeAttributes(machine : u16, machinetypeattributes : *mut MACHINE_ATTRIBUTES) -> HRESULT); | ||
| windows_targets::link!("kernel32.dll" "system" fn PeekNamedPipe(hnamedpipe : HANDLE, lpbuffer : *mut core::ffi::c_void, nbuffersize : u32, lpbytesread : *mut u32, lptotalbytesavail : *mut u32, lpbytesleftthismessage : *mut u32) -> BOOL); | ||
| windows_targets::link!("advapi32.dll" "system" fn RegCloseKey(hkey : HKEY) -> WIN32_ERROR); | ||
| windows_targets::link!("advapi32.dll" "system" fn RegEnumKeyExW(hkey : HKEY, dwindex : u32, lpname : PWSTR, lpcchname : *mut u32, lpreserved : *const u32, lpclass : PWSTR, lpcchclass : *mut u32, lpftlastwritetime : *mut FILETIME) -> WIN32_ERROR); | ||
| windows_targets::link!("advapi32.dll" "system" fn RegOpenKeyExW(hkey : HKEY, lpsubkey : PCWSTR, uloptions : u32, samdesired : REG_SAM_FLAGS, phkresult : *mut HKEY) -> WIN32_ERROR); | ||
| windows_targets::link!("advapi32.dll" "system" fn RegQueryValueExW(hkey : HKEY, lpvaluename : PCWSTR, lpreserved : *const u32, lptype : *mut REG_VALUE_TYPE, lpdata : *mut u8, lpcbdata : *mut u32) -> WIN32_ERROR); | ||
| windows_targets::link!("kernel32.dll" "system" fn ReleaseSemaphore(hsemaphore : HANDLE, lreleasecount : i32, lppreviouscount : *mut i32) -> BOOL); | ||
| windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT); | ||
| windows_targets::link!("ole32.dll" "system" fn CoCreateInstance(rclsid : *const GUID, punkouter : * mut core::ffi::c_void, dwclscontext : CLSCTX, riid : *const GUID, ppv : *mut *mut core::ffi::c_void) -> HRESULT); | ||
| windows_targets::link!("ole32.dll" "system" fn CoInitializeEx(pvreserved : *const core::ffi::c_void, dwcoinit : u32) -> HRESULT); | ||
| windows_targets::link!("oleaut32.dll" "system" fn SysFreeString(bstrstring : BSTR)); | ||
| windows_targets::link!("oleaut32.dll" "system" fn SysStringLen(pbstr : BSTR) -> u32); | ||
| windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT); | ||
| pub type ADVANCED_FEATURE_FLAGS = u16; | ||
@@ -75,2 +76,3 @@ pub type BOOL = i32; | ||
| pub type HANDLE = *mut core::ffi::c_void; | ||
| pub type HINSTANCE = *mut core::ffi::c_void; | ||
| pub type HKEY = *mut core::ffi::c_void; | ||
@@ -82,2 +84,13 @@ pub const HKEY_LOCAL_MACHINE: HKEY = -2147483646i32 as _; | ||
| pub const IMAGE_FILE_MACHINE_AMD64: IMAGE_FILE_MACHINE = 34404u16; | ||
| pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); | ||
| #[repr(C)] | ||
| pub struct IUnknown_Vtbl { | ||
| pub QueryInterface: unsafe extern "system" fn( | ||
| this: *mut core::ffi::c_void, | ||
| iid: *const GUID, | ||
| interface: *mut *mut core::ffi::c_void, | ||
| ) -> HRESULT, | ||
| pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, | ||
| pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, | ||
| } | ||
| pub const KEY_READ: REG_SAM_FLAGS = 131097u32; | ||
@@ -84,0 +97,0 @@ pub const KEY_WOW64_32KEY: REG_SAM_FLAGS = 512u32; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display