From: Joel Rosdahl Date: Tue, 14 Sep 2010 15:10:53 +0000 (+0200) Subject: Make --ccache-skip work for all options X-Git-Tag: v3.1~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8177355fc3bf8f51109ff7d4557c50f71e6e105b;p=thirdparty%2Fccache.git Make --ccache-skip work for all options --- diff --git a/MANUAL.txt b/MANUAL.txt index fbc9d7656..228ead257 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -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 --------------------- diff --git a/NEWS.txt b/NEWS.txt index df05c7757..8f97df500 100644 --- 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 ~~~~~ diff --git a/ccache.c b/ccache.c index 2a4ba22db..e9601b6fb 100644 --- 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. */