]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: Move conversion to slash option outside file test
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 12 Dec 2021 20:12:22 +0000 (21:12 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 12 Dec 2021 20:35:02 +0000 (21:35 +0100)
src/argprocessing.cpp

index b78b16f57c3ec51a9b4114b607864996d6465353..0e2898e510236a358f7ac72120bf9cc0c98fd8c2 100644 (file)
@@ -935,15 +935,17 @@ process_arg(const Context& ctx,
     return nullopt;
   }
 
+  // It was not a known option.
+  if (changed_from_slash) {
+    args[i][0] = '/';
+  }
+
   // If an argument isn't a plain file then assume its an option, not an input
   // file. This allows us to cope better with unusual compiler options.
   //
   // Note that "/dev/null" is an exception that is sometimes used as an input
   // file when code is testing compiler flags.
   if (args[i] != "/dev/null") {
-    if (changed_from_slash) {
-      args[i][0] = '/';
-    }
     auto st = Stat::stat(args[i]);
     if (!st || !st.is_regular()) {
       LOG("{} is not a regular file, not considering as input file", args[i]);