Add CCACHE_STRIPC option to remove an unwarranted warning when using ccache with the Solaris Workshop C++ compiler

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10996 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-12-21 23:16:56 +00:00
commit a648bb7f38
2 changed files with 21 additions and 1 deletions

View file

@ -68,6 +68,9 @@ char *stats_file = NULL;
/* can we safely use the unification hashing backend? */
static int enable_unify;
/* should we strip -c when running the preprocessor only? */
static int strip_c_option;
/* customisation for using the SWIG compiler */
static int swig;
@ -230,6 +233,10 @@ static void to_cache(ARGS *args)
x_asprintf(&tmp_stderr, "%s/tmp.stderr.%s", temp_dir, tmp_string());
x_asprintf(&tmp_outfiles, "%s/tmp.outfiles.%s", temp_dir, tmp_string());
if (strip_c_option) {
args_add(stripped_args, "-c");
}
if (output_file) {
args_add(args, "-o");
args_add(args, output_file);
@ -859,7 +866,9 @@ static void process_args(int argc, char **argv)
/* we must have -c */
if (strcmp(argv[i], "-c") == 0) {
args_add(stripped_args, argv[i]);
if (!strip_c_option) {
args_add(stripped_args, argv[i]);
}
found_c_opt = 1;
continue;
}
@ -1126,6 +1135,10 @@ static void ccache(int argc, char *argv[])
failed();
}
if (getenv("CCACHE_STRIPC")) {
strip_c_option = 1;
}
if (getenv("CCACHE_UNIFY")) {
enable_unify = 1;
}

View file

@ -261,6 +261,13 @@ systems like this you can use the CCACHE_EXTENSION option to override
the default. On HP-UX set this environment variable to "i" if you use
the aCC compiler.
dit(bf(CCACHE_STRIPC)) If you set the environment variable
CCACHE_STRIPC then ccache will strip the -c option when invoking
the preprocessor. This option is primarily for the Sun Workshop
C++ compiler as without this option an unwarranted warning is displayed:
CC: Warning: "-E" redefines product from "object" to "source (stdout)"
when -E and -c is used together.
dit(bf(CCACHE_SWIG)) When using SWIG as the compiler and it does not
have 'swig' in the executable name, then the CCACHE_SWIG environment
variable needs to be set in order for ccache to work correctly with