diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2008-12-21 23:16:56 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2008-12-21 23:16:56 +0000 |
commit | a648bb7f38660ce1acd4803097cf6ba63149da1c (patch) | |
tree | 4d688c33a8506ca263dd062514c61e1aa31f19be | |
parent | b1e7bbd831d1ae60f04ce4204c0c2a39422f6302 (diff) | |
download | swig-a648bb7f38660ce1acd4803097cf6ba63149da1c.tar.gz |
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
-rw-r--r-- | CCache/ccache.c | 15 | ||||
-rw-r--r-- | CCache/ccache.yo | 7 |
2 files changed, 21 insertions, 1 deletions
diff --git a/CCache/ccache.c b/CCache/ccache.c index ce9717b84..486964377 100644 --- a/CCache/ccache.c +++ b/CCache/ccache.c @@ -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; } diff --git a/CCache/ccache.yo b/CCache/ccache.yo index 7f18b9885..08acb843e 100644 --- a/CCache/ccache.yo +++ b/CCache/ccache.yo @@ -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 |