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
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
---------------------
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");
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. */