]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: Rename compiler type cl to msvc
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 23 Jan 2022 15:54:30 +0000 (16:54 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 23 Jan 2022 15:54:30 +0000 (16:54 +0100)
src/Config.cpp
src/Config.hpp
src/argprocessing.cpp
src/ccache.cpp

index 14c21a09d3bb6c9a362d5591026db76f810394a9..7e4579625d1118abf283c29bffc6235df50759ca 100644 (file)
@@ -450,9 +450,9 @@ compiler_type_to_string(CompilerType compiler_type)
 
     CASE(clang);
     CASE(gcc);
+    CASE(msvc);
     CASE(nvcc);
     CASE(other);
-    CASE(cl);
   }
 #undef CASE
 
index a21e7ff198a2885a56fd5b24c5b5c1f4183accbd..da84e07743eda3b29b1a77cdaec32ea743bc8fa1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2021 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2022 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -31,7 +31,7 @@
 #include <string>
 #include <unordered_map>
 
-enum class CompilerType { auto_guess, clang, gcc, nvcc, other, cl };
+enum class CompilerType { auto_guess, clang, gcc, msvc, nvcc, other };
 
 std::string compiler_type_to_string(CompilerType compiler_type);
 
index a5b3a49af29f1d0595fee876673d4eb4b2e10b0d..e8d8db8c41295900286c791cffa218afbfe01267 100644 (file)
@@ -273,7 +273,7 @@ process_arg(const Context& ctx,
   }
 
   bool changed_from_slash = false;
-  if (ctx.config.compiler_type() == CompilerType::cl
+  if (ctx.config.compiler_type() == CompilerType::msvc
       && util::starts_with(args[i], "/")) {
     // MSVC understands both /option and -option, so convert all /option to
     // -option to simplify our handling.
@@ -295,7 +295,7 @@ process_arg(const Context& ctx,
     return Statistic::called_for_preprocessing;
   }
   // MSVC -P is -E with output to a file.
-  if (args[i] == "-P" && ctx.config.compiler_type() == CompilerType::cl) {
+  if (args[i] == "-P" && ctx.config.compiler_type() == CompilerType::msvc) {
     return Statistic::called_for_preprocessing;
   }
 
@@ -307,7 +307,7 @@ process_arg(const Context& ctx,
       ++argpath;
     }
     auto file_args =
-      Args::from_atfile(argpath, config.compiler_type() == CompilerType::cl);
+      Args::from_atfile(argpath, config.compiler_type() == CompilerType::msvc);
     if (!file_args) {
       LOG("Couldn't read arg file {}", argpath);
       return Statistic::bad_compiler_arguments;
@@ -451,7 +451,7 @@ process_arg(const Context& ctx,
 
   // MSVC -Fo with no space.
   if (util::starts_with(args[i], "-Fo")
-      && config.compiler_type() == CompilerType::cl) {
+      && config.compiler_type() == CompilerType::msvc) {
     args_info.output_obj =
       Util::make_relative_path(ctx, string_view(args[i]).substr(3));
     return nullopt;
@@ -566,7 +566,7 @@ process_arg(const Context& ctx,
   // These options require special handling, because they behave differently
   // with gcc -E, when the output file is not specified.
   if ((args[i] == "-MD" || args[i] == "-MMD")
-      && config.compiler_type() != CompilerType::cl) {
+      && config.compiler_type() != CompilerType::msvc) {
     args_info.generating_dependencies = true;
     args_info.seen_MD_MMD = true;
     state.dep_args.push_back(args[i]);
@@ -602,7 +602,7 @@ process_arg(const Context& ctx,
   }
 
   if ((util::starts_with(args[i], "-MQ") || util::starts_with(args[i], "-MT"))
-      && config.compiler_type() != CompilerType::cl) {
+      && config.compiler_type() != CompilerType::msvc) {
     args_info.dependency_target_specified = true;
 
     if (args[i].size() == 3) {
@@ -626,7 +626,7 @@ process_arg(const Context& ctx,
 
   // MSVC -MD[d], -MT[d] and -LT[d] options are something different than GCC's
   // -MD etc.
-  if (config.compiler_type() == CompilerType::cl
+  if (config.compiler_type() == CompilerType::msvc
       && (util::starts_with(args[i], "-MD") || util::starts_with(args[i], "-MT")
           || util::starts_with(args[i], "-LD"))) {
     // These affect compiler but also #define some things.
@@ -876,7 +876,7 @@ process_arg(const Context& ctx,
   }
 
   // MSVC -u is something else than GCC -u, handle it specially.
-  if (args[i] == "-u" && ctx.config.compiler_type() == CompilerType::cl) {
+  if (args[i] == "-u" && ctx.config.compiler_type() == CompilerType::msvc) {
     state.cpp_args.push_back(args[i]);
     return nullopt;
   }
@@ -1126,7 +1126,7 @@ process_args(Context& ctx)
     string_view extension;
     if (state.found_S_opt) {
       extension = ".s";
-    } else if (ctx.config.compiler_type() != CompilerType::cl) {
+    } else if (ctx.config.compiler_type() != CompilerType::msvc) {
       extension = ".o";
     } else {
       extension = ".obj";
@@ -1286,7 +1286,7 @@ process_args(Context& ctx)
   if (!state.input_charset_option.empty()) {
     state.cpp_args.push_back(state.input_charset_option);
   }
-  if (state.found_pch && ctx.config.compiler_type() != CompilerType::cl) {
+  if (state.found_pch && ctx.config.compiler_type() != CompilerType::msvc) {
     state.cpp_args.push_back("-fpch-preprocess");
   }
   if (!state.explicit_language.empty()) {
index 939189b3caef9632f4f67c8896c0c952124f4eb4..3a8a89d71694232e0d44c1138b7088239fd07565 100644 (file)
@@ -236,7 +236,7 @@ guess_compiler(string_view path)
   } else if (name.find("nvcc") != nonstd::string_view::npos) {
     return CompilerType::nvcc;
   } else if (name.find("cl") != nonstd::string_view::npos) {
-    return CompilerType::cl;
+    return CompilerType::msvc;
   } else {
     return CompilerType::other;
   }
@@ -933,7 +933,7 @@ to_cache(Context& ctx,
          const Args& depend_extra_args,
          Hash* depend_mode_hash)
 {
-  if (ctx.config.compiler_type() == CompilerType::cl) {
+  if (ctx.config.compiler_type() == CompilerType::msvc) {
     args.push_back(fmt::format("-Fo{}", ctx.args_info.output_obj));
   } else {
     args.push_back("-o");
@@ -2116,7 +2116,7 @@ do_cache_compilation(Context& ctx, const char* const* argv)
   TRY(set_up_uncached_err());
 
   if (!ctx.config.run_second_cpp()
-      && ctx.config.compiler_type() == CompilerType::cl) {
+      && ctx.config.compiler_type() == CompilerType::msvc) {
     LOG_RAW("Second preprocessor cannot be disabled");
     ctx.config.set_run_second_cpp(true);
   }