]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Make --ccache-skip work for all options
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 14 Sep 2010 15:10:53 +0000 (17:10 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 14 Sep 2010 15:10:53 +0000 (17:10 +0200)
MANUAL.txt
NEWS.txt
ccache.c

index fbc9d7656f11369cbda91ee1734d4a67292ef3be..228ead2579b3c76b9683404551b1423a1557985d 100644 (file)
@@ -150,9 +150,8 @@ Extra options
 
 When run as a compiler, ccache usually just takes the same command line options
 as the compiler you are using. The only exception to this is the option
-*--ccache-skip*. That option can be used to tell ccache that the next option is
-definitely not a input filename, and should be passed along to the compiler
-as-is.
+*--ccache-skip*. That option can be used to tell ccache to avoid interpreting
+the next option in any way and to pass it along to the compiler as-is.
 
 The reason this can be important is that ccache does need to parse the command
 line and determine what is an input filename and what is a compiler option, as
@@ -162,6 +161,10 @@ is that any argument that exists as a file is treated as an input file name. By
 using *--ccache-skip* you can force an option to not be treated as an input
 file name and instead be passed along to the compiler as a command line option.
 
+Another case where *--ccache-skip* can be useful is if ccache interprets an
+option specially but shouldn't, since the option has another meaning for your
+compiler than what ccache thinks.
+
 
 Environment variables
 ---------------------
index df05c775714481be5020fe09afb62692055989ff..8f97df5004ef7b47510d88bbb147ab0475f410f8 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -53,6 +53,8 @@ Bug fixes
 
     - Fixed a bug affecting failing commands when `--ccache-skip` is used.
 
+    - Made `--ccache-skip` work for all options.
+
 
 Other
 ~~~~~
index 2a4ba22db8ae98aaf3b7665f70d5e90f97938db0..e9601b6fb22d199cfa0a05fe58c20d5fa45edb8c 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1211,6 +1211,18 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args,
        args_add(stripped_args, argv[0]);
 
        for (i = 1; i < argc; i++) {
+               /* The user knows best: just swallow the next arg */
+               if (str_eq(argv[i], "--ccache-skip")) {
+                       i++;
+                       if (i == argc) {
+                               cc_log("--ccache-skip lacks an argument");
+                               result = false;
+                               goto out;
+                       }
+                       args_add(stripped_args, argv[i]);
+                       continue;
+               }
+
                /* some options will never work ... */
                if (str_eq(argv[i], "-E")) {
                        cc_log("Compiler option -E is unsupported");
@@ -1328,18 +1340,6 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args,
                        continue;
                }
 
-               /* The user knows best: just swallow the next arg */
-               if (str_eq(argv[i], "--ccache-skip")) {
-                       i++;
-                       if (i == argc) {
-                               cc_log("--ccache-skip lacks an argument");
-                               result = false;
-                               goto out;
-                       }
-                       args_add(stripped_args, argv[i]);
-                       continue;
-               }
-
                /* These options require special handling, because they
                   behave differently with gcc -E, when the output
                   file is not specified. */