diff --git a/Cargo.lock b/Cargo.lock index 96f213671..d32d9ca32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2293,7 +2293,7 @@ dependencies = [ [[package]] name = "sccache" -version = "0.8.1" +version = "1.8.1" dependencies = [ "anyhow", "ar", diff --git a/Cargo.toml b/Cargo.toml index b69c47e3f..2d8b5fe58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ edition = "2021" name = "sccache" rust-version = "1.70.0" -version = "0.8.1" +version = "1.8.1" categories = ["command-line-utilities", "development-tools::build-utils"] description = "Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage." @@ -162,6 +162,7 @@ all = [ "gha", "webdav", "oss", + "topscc", ] azure = ["opendal/services-azblob", "reqsign"] default = ["all"] @@ -173,6 +174,7 @@ oss = ["opendal/services-oss", "reqsign"] redis = ["url", "opendal/services-redis"] s3 = ["opendal/services-s3", "reqsign", "reqwest"] webdav = ["opendal/services-webdav"] +topscc = [] # Enable features that will build a vendored version of openssl and # statically linked with it, instead of linking against the system-wide openssl # dynamically or statically. diff --git a/src/cmdline.rs b/src/cmdline.rs index df2c28f2c..6fbfea906 100644 --- a/src/cmdline.rs +++ b/src/cmdline.rs @@ -119,6 +119,8 @@ fn get_clap_command() -> clap::Command { "\n", " Azure: ", cfg!(feature = "azure"), + "\n", + " TOPSCC: true", "\n" )) .args(&[ diff --git a/src/compiler/clang.rs b/src/compiler/clang.rs index 370754645..bdcaca194 100644 --- a/src/compiler/clang.rs +++ b/src/compiler/clang.rs @@ -181,6 +181,7 @@ counted_array!(pub static ARGS: [ArgInfo; _] = [ take_arg!("-debug-info-kind", OsString, Concatenated('='), PassThrough), take_arg!("-dependency-file", PathBuf, Separated, DepArgumentPath), flag!("-emit-pch", PassThroughFlag), + flag!("-fallow-half-arguments-and-returns", PassThroughFlag), flag!("-fcolor-diagnostics", DiagnosticsColorFlag), flag!("-fcxx-modules", TooHardFlag), take_arg!("-fdebug-compilation-dir", OsString, Separated, PassThrough), diff --git a/src/compiler/compiler.rs b/src/compiler/compiler.rs index d1c4692d4..1dd864f0c 100644 --- a/src/compiler/compiler.rs +++ b/src/compiler/compiler.rs @@ -114,6 +114,7 @@ pub enum Language { Cuda, Rust, Hip, + Tops, } impl Language { @@ -134,6 +135,8 @@ impl Language { Some("M") | Some("mm") => Some(Language::ObjectiveCxx), // TODO mii Some("cu") => Some(Language::Cuda), + // TODO topscc + Some("tops") => Some(Language::Tops), // TODO cy Some("rs") => Some(Language::Rust), Some("hip") => Some(Language::Hip), @@ -154,6 +157,7 @@ impl Language { Language::Cuda => "cuda", Language::Rust => "rust", Language::Hip => "hip", + Language::Tops => "tops", } } } @@ -171,6 +175,7 @@ impl CompilerKind { Language::Cuda => "CUDA", Language::Rust => "Rust", Language::Hip => "HIP", + Language::Tops => "TOPS", } .to_string() } @@ -1286,7 +1291,7 @@ compiler_version=__VERSION__ } } - cmd.arg("-E").arg(src); + cmd.arg("-E").arg(src).arg("-o").arg("-"); trace!("compiler {:?}", cmd); let child = cmd.spawn().await?; let output = child @@ -1295,7 +1300,6 @@ compiler_version=__VERSION__ .context("failed to read child output")?; drop(tempdir); - let stdout = match str::from_utf8(&output.stdout) { Ok(s) => s, Err(_) => bail!("Failed to parse output"), diff --git a/src/compiler/gcc.rs b/src/compiler/gcc.rs index 5f26a1a77..d6a1f2039 100644 --- a/src/compiler/gcc.rs +++ b/src/compiler/gcc.rs @@ -123,6 +123,8 @@ ArgData! { pub PassThroughFlag, PassThrough(OsString), PassThroughPath(PathBuf), + TopsDeviceLibPath(PathBuf), + TopsDeviceLib(OsString), PreprocessorArgumentFlag, PreprocessorArgument(OsString), PreprocessorArgumentPath(PathBuf), @@ -162,6 +164,8 @@ counted_array!(pub static ARGS: [ArgInfo; _] = [ flag!("--save-temps", TooHardFlag), take_arg!("--serialize-diagnostics", PathBuf, Separated, PassThroughPath), take_arg!("--sysroot", PathBuf, Separated, PassThroughPath), + take_arg!("--tops-device-lib", OsString, Concatenated('='), TopsDeviceLib), + take_arg!("--tops-device-lib-path", PathBuf, Concatenated('='), TopsDeviceLibPath), take_arg!("-A", OsString, Separated, PassThrough), take_arg!("-B", PathBuf, CanBeSeparated, PassThroughPath), take_arg!("-D", OsString, CanBeSeparated, PassThrough), @@ -284,6 +288,7 @@ where let mut color_mode = ColorMode::Auto; let mut seen_arch = None; let dont_cache_multiarch = env::var("SCCACHE_CACHE_MULTIARCH").is_err(); + let mut tops_device_lib_path = PathBuf::new(); // Custom iterator to expand `@` arguments which stand for reading a file // and interpreting it as a list of more arguments. @@ -330,6 +335,13 @@ where compilation_flag = OsString::from(arg.flag_str().expect("Compilation flag expected")); } + Some(TopsDeviceLibPath(_tops_device_lib_path)) => tops_device_lib_path = _tops_device_lib_path.to_path_buf(), + Some(TopsDeviceLib(tops_device_lib_)) => { + if ! tops_device_lib_path.as_os_str().is_empty() { + let tops_device_lib = tops_device_lib_path.join(tops_device_lib_); + extra_hash_files.push(tops_device_lib.clone()); + } + } Some(ProfileGenerate) => profile_generate = true, Some(ClangProfileUse(path)) => { extra_hash_files.push(clang::resolve_profile_use_path(path, cwd)); @@ -379,6 +391,7 @@ where "objective-c" => Some(Language::ObjectiveC), "objective-c++" => Some(Language::ObjectiveCxx), "cu" => Some(Language::Cuda), + "tops" => Some(Language::Tops), "rs" => Some(Language::Rust), "cuda" => Some(Language::Cuda), "hip" => Some(Language::Hip), @@ -427,6 +440,8 @@ where | Some(NoDiagnosticsColorFlag) | Some(PassThroughFlag) | Some(PassThrough(_)) + | Some(TopsDeviceLibPath(_)) + | Some(TopsDeviceLib(_)) | Some(PassThroughPath(_)) => &mut common_args, Some(Unhashed(_)) => &mut unhashed_args, Some(Arch(_)) => &mut arch_args, @@ -504,6 +519,8 @@ where | Some(NoDiagnosticsColorFlag) | Some(Arch(_)) | Some(PassThrough(_)) + | Some(TopsDeviceLibPath(_)) + | Some(TopsDeviceLib(_)) | Some(PassThroughFlag) | Some(PassThroughPath(_)) => &mut common_args, Some(Unhashed(_)) => &mut unhashed_args, @@ -645,6 +662,7 @@ fn language_to_gcc_arg(lang: Language) -> Option<&'static str> { Language::ObjectiveC => Some("objective-c"), Language::ObjectiveCxx => Some("objective-c++"), Language::Cuda => Some("cu"), + Language::Tops => Some("tops"), Language::Rust => None, // Let the compiler decide Language::Hip => Some("hip"), Language::GenericHeader => None, // Let the compiler decide @@ -668,7 +686,7 @@ fn preprocess_cmd( if let Some(lang) = &language { cmd.arg("-x").arg(lang); } - cmd.arg("-E"); + cmd.arg("-E").arg("-o").arg("-"); // When performing distributed compilation, line number info is important for error // reporting and to not cause spurious compilation failure (e.g. no exceptions build // fails due to exceptions transitively included in the stdlib). diff --git a/src/compiler/msvc.rs b/src/compiler/msvc.rs index 9eae06413..e53321c5c 100644 --- a/src/compiler/msvc.rs +++ b/src/compiler/msvc.rs @@ -663,6 +663,8 @@ pub fn parse_arguments( | Some(PassThroughFlag) | Some(PassThrough(_)) | Some(PassThroughPath(_)) + | Some(TopsDeviceLibPath(_)) + | Some(TopsDeviceLib(_)) | Some(PedanticFlag) | Some(Standard(_)) => &mut common_args, Some(Unhashed(_)) => &mut unhashed_args,