]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Allow (require) argument to -Werror for NVCC
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 21 Jul 2020 17:45:58 +0000 (19:45 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 21 Jul 2020 17:53:38 +0000 (19:53 +0200)
Fixes #598.

(cherry picked from commit c5349149864104146dab2c9bcd67a1b2ff565f06)

src/argprocessing.cpp
src/ccache.cpp
test/suites/nvcc.bash

index d81a9d3a80d05317e203f056d7bf0bab71739ebe..e072017eab0099383df25eab74430a8157e7b3a3 100644 (file)
@@ -311,7 +311,9 @@ process_arg(Context& ctx,
   // Handle options that should not be passed to the preprocessor.
   if (compopt_affects_comp(args[i])) {
     state.compiler_only_args.push_back(args[i]);
-    if (compopt_takes_arg(args[i])) {
+    if (compopt_takes_arg(args[i])
+        || (ctx.guessed_compiler == GuessedCompiler::nvcc
+            && args[i] == "-Werror")) {
       if (i == args.size() - 1) {
         cc_log("Missing argument to %s", args[i].c_str());
         return STATS_ARGS;
index 6bb9235d66d72c25a5c150c6d2e274deca999750..f7f27ef3b09acb5902b46648a45a10bb1427e0a4 100644 (file)
@@ -1524,7 +1524,7 @@ calculate_result_name(Context& ctx,
 
     if ((args[i] == "-ccbin" || args[i] == "--compiler-bindir")
         && i + 1 < args.size()) {
-      auto st = Stat::stat(args[i + 1], Stat::OnError::log);
+      auto st = Stat::stat(args[i + 1]);
       if (st) {
         found_ccbin = true;
         hash.hash_delimiter("ccbin");
index 3ee5c31785fc252780838e0708b8e47f933fa606..1e8cb9be00ec72b9240804ee771f1b4950cf53b5 100644 (file)
@@ -286,6 +286,19 @@ nvcc_tests() {
     expect_stat 'cache miss' 1
     expect_stat 'files in cache' 1
     expect_equal_files reference_test1.o test_cpp.o
+
+    # -------------------------------------------------------------------------
+    TEST "Option -Werror"
+
+    $ccache_nvcc_cpp -Werror cross-execution-space-call test_cpp.cu
+    expect_stat 'cache hit (preprocessed)' 0
+    expect_stat 'cache miss' 1
+    expect_stat 'files in cache' 1
+
+    $ccache_nvcc_cpp -Werror cross-execution-space-call test_cpp.cu
+    expect_stat 'cache hit (preprocessed)' 1
+    expect_stat 'cache miss' 1
+    expect_stat 'files in cache' 1
 }
 
 SUITE_nvcc_PROBE() {