Imported Upstream version 3.2.4 upstream/3.2.4
authorJinWang An <jinwang.an@samsung.com>
Tue, 3 Aug 2021 07:17:01 +0000 (16:17 +0900)
committerJinWang An <jinwang.an@samsung.com>
Tue, 3 Aug 2021 07:17:01 +0000 (16:17 +0900)
19 files changed:
AUTHORS.html
AUTHORS.txt
Makefile.in
NEWS.html
NEWS.txt
ccache.1
ccache.c
ccache.h
conf.c
configure
configure.ac
execute.c
language.c
stats.c
system.h
test/test_argument_processing.c
test/test_util.c
util.c
version.c

index caf082a..66fc0f6 100644 (file)
@@ -734,7 +734,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache authors</h1>\r
-<span id="revnumber">version 3.2.3</span>\r
+<span id="revnumber">version 3.2.4</span>\r
 <div id="toc">
   <div id="toctitle">Table of Contents</div>
   <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
@@ -964,6 +964,11 @@ Tor Arne Vestbø &lt;<a href="mailto:torarnv@gmail.com">torarnv@gmail.com</a>&gt
 </li>\r
 <li>\r
 <p>\r
+Vadim Petrochenkov &lt;<a href="mailto:vadim.petrochenkov@gmail.com">vadim.petrochenkov@gmail.com</a>&gt;\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
 Ville Skyttä &lt;<a href="mailto:ville.skytta@iki.fi">ville.skytta@iki.fi</a>&gt;\r
 </p>\r
 </li>\r
@@ -990,9 +995,9 @@ Yiding Jia &lt;<a href="mailto:yiding@fb.com">yiding@fb.com</a>&gt;
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.2.3<br />\r
+Version 3.2.4<br />\r
 Last updated\r
- 2015-08-16 14:11:14 CEST\r
+ 2015-10-08 21:10:53 CEST\r
 </div>\r
 </div>\r
 </body>\r
index d8df111..f837d52 100644 (file)
@@ -49,6 +49,7 @@ ccache is a collective work with contributions from many people, including:
 * Ryan Brown <ryb@ableton.com>
 * Tim Potter <tpot@samba.org>
 * Tor Arne Vestbø <torarnv@gmail.com>
+* Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
 * Ville Skyttä <ville.skytta@iki.fi>
 * William S Fulton <wsf@fultondesigns.co.uk>
 * Wilson Snyder <wsnyder@wsnyder.org>
index e7515b1..30beb2b 100644 (file)
@@ -19,8 +19,7 @@ LIBS = @LIBS@
 RANLIB = @RANLIB@
 
 all_cflags = $(CFLAGS)
-all_cppflags = @DEFS@ @extra_cppflags@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir) $(CPPFLAGS)
-all_ldflags = @extra_ldflags@ $(LDFLAGS)
+all_cppflags = @DEFS@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir) $(CPPFLAGS)
 extra_libs = @extra_libs@
 
 base_sources = \
@@ -53,7 +52,7 @@ files_to_distclean = Makefile config.h config.log config.status
 all: ccache$(EXEEXT)
 
 ccache$(EXEEXT): $(ccache_objs) $(extra_libs)
-       $(CC) $(all_cflags) -o $@ $(ccache_objs) $(all_ldflags) $(extra_libs) $(LIBS)
+       $(CC) $(all_cflags) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
 
 .PHONY: install
 install: all
@@ -88,7 +87,7 @@ quicktest: test/main$(EXEEXT)
        test/main$(EXEEXT)
 
 test/main$(EXEEXT): $(base_objs) $(test_objs) $(extra_libs)
-       $(CC) $(all_cflags) -o $@ $(base_objs) $(test_objs) $(all_ldflags) $(extra_libs) $(LIBS)
+       $(CC) $(all_cflags) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
 
 test/main.o: test/suites.h
 
index a233876..7bd6950 100644 (file)
--- a/NEWS.html
+++ b/NEWS.html
@@ -734,7 +734,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache news</h1>\r
-<span id="revnumber">version 3.2.3</span>\r
+<span id="revnumber">version 3.2.4</span>\r
 <div id="toc">
   <div id="toctitle">Table of Contents</div>
   <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
@@ -742,6 +742,51 @@ asciidoc.install(2);
 </div>\r
 <div id="content">\r
 <div class="sect1">\r
+<h2 id="_ccache_3_2_4">ccache 3.2.4</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>Release date: 2015-10-08</p></div>\r
+<div class="sect2">\r
+<h3 id="_bug_fixes">Bug fixes</h3>\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+Fixed build error related to zlib on systems with older make versions\r
+  (regression in ccache 3.2.3).\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Made conversion-to-bool explicit to avoid build warnings (and potential\r
+  runtime errors) on legacy systems.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Improved signal handling: Kill compiler on SIGTERM; wait for compiler to exit\r
+  before exiting; die appropriately.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Minor fixes related to Windows support.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+The correct compression level is now used if compression is requested.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Fixed a bug where cache cleanup could be run too early for caches larger than\r
+  64 GiB on 32-bit systems.\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
 <h2 id="_ccache_3_2_3">ccache 3.2.3</h2>\r
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2015-08-16</p></div>\r
@@ -756,7 +801,7 @@ Added support for compiler option <code>-gsplit-dwarf</code>.
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes">Bug fixes</h3>\r
+<h3 id="_bug_fixes_2">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -810,7 +855,7 @@ Add support for caching code coverage results (compiling for gcov).
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_2">Bug fixes</h3>\r
+<h3 id="_bug_fixes_3">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -881,7 +926,7 @@ Fixed build error when compiling ccache with recent clang versions.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2014-12-10</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_3">Bug fixes</h3>\r
+<h3 id="_bug_fixes_4">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1113,7 +1158,7 @@ Various other improvements of the test suite.
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_4">Bug fixes</h3>\r
+<h3 id="_bug_fixes_5">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1144,7 +1189,7 @@ Fixed test suite failures when <code>CC</code> is a ccache-wrapped compiler.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2015-03-07</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_5">Bug fixes</h3>\r
+<h3 id="_bug_fixes_6">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1227,7 +1272,7 @@ Stale files in the internal temporary directory (<code>&lt;ccache_dir&gt;/tmp</c
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_6">Bug fixes</h3>\r
+<h3 id="_bug_fixes_7">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1267,7 +1312,7 @@ Fixed problem with logging of current working directory.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2013-01-06</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_7">Bug fixes</h3>\r
+<h3 id="_bug_fixes_8">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1338,7 +1383,7 @@ Clang plugins are now hashed to catch plugin upgrades.
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_8">Bug fixes</h3>\r
+<h3 id="_bug_fixes_9">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1386,7 +1431,7 @@ Fixed <code>static_assert</code> macro definition clash with GCC 4.7.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2012-01-08</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_9">Bug fixes</h3>\r
+<h3 id="_bug_fixes_10">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1469,7 +1514,7 @@ Rewrite argument to <code>--sysroot</code> if <code>CCACHE_BASEDIR</code> is use
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_10">Bug fixes</h3>\r
+<h3 id="_bug_fixes_11">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1522,7 +1567,7 @@ Improved order of statistics counters in <code>ccache -s</code> output.
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_11">Bug fixes</h3>\r
+<h3 id="_bug_fixes_12">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1555,7 +1600,7 @@ Systems that lack (and don&#8217;t need to be linked with) libm are now supporte
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2011-01-09</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_12">Bug fixes</h3>\r
+<h3 id="_bug_fixes_13">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1588,7 +1633,7 @@ The file handle in now correctly closed on write error when trying to create
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2010-11-28</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_13">Bug fixes</h3>\r
+<h3 id="_bug_fixes_14">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1615,7 +1660,7 @@ Portability fixes for HP-UX 11.00 and other esoteric systems.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2010-11-21</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_14">Bug fixes</h3>\r
+<h3 id="_bug_fixes_15">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1663,7 +1708,7 @@ The test suite now also works on systems that lack a /dev/zero.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2010-11-07</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_15">Bug fixes</h3>\r
+<h3 id="_bug_fixes_16">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1785,7 +1830,7 @@ Added <code>-install_name</code> as an option known to take an argument. (This i
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_16">Bug fixes</h3>\r
+<h3 id="_bug_fixes_17">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1871,7 +1916,7 @@ New <code>HACKING.txt</code> file with some notes about ccache code conventions.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2010-07-15</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_17">Bug fixes</h3>\r
+<h3 id="_bug_fixes_18">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2060,7 +2105,7 @@ The following options are no longer hashed in the preprocessor mode:
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_18">Bug fixes</h3>\r
+<h3 id="_bug_fixes_19">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2205,9 +2250,9 @@ Statistics counters are now correctly updated for -E option failures and
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.2.3<br />\r
+Version 3.2.4<br />\r
 Last updated\r
- 2015-08-16 14:00:42 CEST\r
+ 2015-10-08 21:12:12 CEST\r
 </div>\r
 </div>\r
 </body>\r
index f13feeb..084879d 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -2,6 +2,31 @@ ccache news
 ===========
 
 
+ccache 3.2.4
+------------
+Release date: 2015-10-08
+
+
+Bug fixes
+~~~~~~~~~
+
+- Fixed build error related to zlib on systems with older make versions
+  (regression in ccache 3.2.3).
+
+- Made conversion-to-bool explicit to avoid build warnings (and potential
+  runtime errors) on legacy systems.
+
+- Improved signal handling: Kill compiler on SIGTERM; wait for compiler to exit
+  before exiting; die appropriately.
+
+- Minor fixes related to Windows support.
+
+- The correct compression level is now used if compression is requested.
+
+- Fixed a bug where cache cleanup could be run too early for caches larger than
+  64 GiB on 32-bit systems.
+
+
 ccache 3.2.3
 ------------
 Release date: 2015-08-16
index 05c6dd8..e6110fb 100644 (file)
--- a/ccache.1
+++ b/ccache.1
@@ -2,12 +2,12 @@
 .\"     Title: ccache
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 08/16/2015
+.\"      Date: 10/08/2015
 .\"    Manual: ccache Manual
-.\"    Source: ccache 3.2.3
+.\"    Source: ccache 3.2.4
 .\"  Language: English
 .\"
-.TH "CCACHE" "1" "08/16/2015" "ccache 3\&.2\&.3" "ccache Manual"
+.TH "CCACHE" "1" "10/08/2015" "ccache 3\&.2\&.4" "ccache Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index c69745f..621f678 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -239,6 +239,12 @@ struct pending_tmp_file {
 /* Temporary files to remove at program exit. */
 static struct pending_tmp_file *pending_tmp_files = NULL;
 
+static sigset_t fatal_signal_set;
+
+/* PID of currently executing compiler that we have started, if any. 0 means no
+ * ongoing compilation. */
+static pid_t compiler_pid = 0;
+
 /*
  * This is a string that identifies the current "version" of the hash sum
  * computed by ccache. If, for any reason, we want to force the hash sum to be
@@ -314,17 +320,35 @@ temp_dir()
        return path;
 }
 
+void
+block_signals(void)
+{
+       sigprocmask(SIG_BLOCK, &fatal_signal_set, NULL);
+}
+
+void
+unblock_signals(void)
+{
+       sigset_t empty;
+       sigemptyset(&empty);
+       sigprocmask(SIG_SETMASK, &empty, NULL);
+}
+
 static void
 add_pending_tmp_file(const char *path)
 {
-       struct pending_tmp_file *e = x_malloc(sizeof(*e));
+       struct pending_tmp_file *e;
+
+       block_signals();
+       e = x_malloc(sizeof(*e));
        e->path = x_strdup(path);
        e->next = pending_tmp_files;
        pending_tmp_files = e;
+       unblock_signals();
 }
 
 static void
-clean_up_pending_tmp_files(void)
+do_clean_up_pending_tmp_files(void)
 {
        struct pending_tmp_file *p = pending_tmp_files;
        while (p) {
@@ -337,11 +361,72 @@ clean_up_pending_tmp_files(void)
 }
 
 static void
-signal_handler(int signo)
+clean_up_pending_tmp_files(void)
 {
-       (void)signo;
-       clean_up_pending_tmp_files();
-       _exit(1);
+       block_signals();
+       do_clean_up_pending_tmp_files();
+       unblock_signals();
+}
+
+static void
+signal_handler(int signum)
+{
+       /* Unregister handler for this signal so that we can send the signal to
+        * ourselves at the end of the handler. */
+       signal(signum, SIG_DFL);
+
+       /* If ccache was killed explicitly, then bring the compiler subprocess (if
+        * any) with us as well. */
+       if (signum == SIGTERM
+           && compiler_pid != 0
+           && waitpid(compiler_pid, NULL, WNOHANG) == 0) {
+               kill(compiler_pid, signum);
+       }
+
+       do_clean_up_pending_tmp_files();
+
+       if (compiler_pid != 0) {
+               /* Wait for compiler subprocess to exit before we snuff it. */
+               waitpid(compiler_pid, NULL, 0);
+       }
+
+       /* Resend signal to ourselves to exit properly after returning from the
+        * handler. */
+       kill(getpid(), signum);
+}
+
+static void
+register_signal_handler(int signum)
+{
+       struct sigaction act;
+       memset(&act, 0, sizeof(act));
+       act.sa_handler = signal_handler;
+       act.sa_mask = fatal_signal_set;
+       act.sa_flags = SA_RESTART;
+       sigaction(signum, &act, NULL);
+}
+
+static void
+set_up_signal_handlers(void)
+{
+       sigemptyset(&fatal_signal_set);
+       sigaddset(&fatal_signal_set, SIGINT);
+       sigaddset(&fatal_signal_set, SIGTERM);
+#ifdef SIGHUP
+       sigaddset(&fatal_signal_set, SIGHUP);
+#endif
+#ifdef SIGQUIT
+       sigaddset(&fatal_signal_set, SIGQUIT);
+#endif
+
+       register_signal_handler(SIGINT);
+       register_signal_handler(SIGTERM);
+#ifdef SIGHUP
+       register_signal_handler(SIGHUP);
+#endif
+#ifdef SIGQUIT
+       register_signal_handler(SIGQUIT);
+#endif
 }
 
 static void
@@ -719,7 +804,8 @@ put_file_in_cache(const char *source, const char *dest)
                x_unlink(dest);
                ret = link(source, dest);
        } else {
-               ret = copy_file(source, dest, conf->compression);
+               ret = copy_file(
+                 source, dest, conf->compression ? conf->compression_level : 0);
        }
        if (ret != 0) {
                cc_log("Failed to %s %s to %s: %s",
@@ -877,7 +963,7 @@ to_cache(struct args *args)
        }
 
        cc_log("Running real compiler");
-       status = execute(args->argv, tmp_stdout_fd, tmp_stderr_fd);
+       status = execute(args->argv, tmp_stdout_fd, tmp_stderr_fd, &compiler_pid);
        args_pop(args, 3);
 
        if (x_stat(tmp_stdout, &st) != 0) {
@@ -1140,7 +1226,7 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash)
                args_add(args, "-E");
                args_add(args, input_file);
                cc_log("Running preprocessor");
-               status = execute(args->argv, path_stdout_fd, path_stderr_fd);
+               status = execute(args->argv, path_stdout_fd, path_stderr_fd, &compiler_pid);
                args_pop(args, 2);
        }
 
@@ -1263,7 +1349,7 @@ static bool
 compiler_is_clang(struct args *args)
 {
        char *name = basename(args->argv[0]);
-       bool is = strstr(name, "clang");
+       bool is = strstr(name, "clang") != NULL;
        free(name);
        return is;
 }
@@ -2858,17 +2944,13 @@ ccache(int argc, char *argv[])
        /* Arguments to send to the real compiler. */
        struct args *compiler_args;
 
+       set_up_signal_handlers();
+
        orig_args = args_init(argc, argv);
 
        initialize();
        find_compiler(argv);
 
-#ifndef _WIN32
-       signal(SIGHUP, signal_handler);
-#endif
-       signal(SIGINT, signal_handler);
-       signal(SIGTERM, signal_handler);
-
        if (str_eq(conf->temporary_dir, "")) {
                clean_up_internal_tempdir();
        }
index 819b7a4..0015c50 100644 (file)
--- a/ccache.h
+++ b/ccache.h
@@ -186,7 +186,7 @@ void stats_summary(struct conf *conf);
 void stats_update_size(uint64_t size, unsigned files);
 void stats_get_obsolete_limits(const char *dir, unsigned *maxfiles,
                                uint64_t *maxsize);
-void stats_set_sizes(const char *dir, size_t num_files, size_t total_size);
+void stats_set_sizes(const char *dir, unsigned num_files, uint64_t total_size);
 void stats_read(const char *path, struct counters *counters);
 void stats_write(const char *path, struct counters *counters);
 
@@ -213,7 +213,7 @@ void wipe_all(struct conf *conf);
 /* ------------------------------------------------------------------------- */
 /* execute.c */
 
-int execute(char **argv, int fd_out, int fd_err);
+int execute(char **argv, int fd_out, int fd_err, pid_t *pid);
 char *find_executable(const char *name, const char *exclude_name);
 void print_command(FILE *fp, char **argv);
 
@@ -227,6 +227,8 @@ void lockfile_release(const char *path);
 /* ccache.c */
 
 extern time_t time_of_compilation;
+void block_signals(void);
+void unblock_signals(void);
 bool cc_process_args(struct args *args, struct args **preprocessor_args,
                     struct args **compiler_args);
 void cc_reset(void);
diff --git a/conf.c b/conf.c
index cc092f2..e8bd523 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -58,7 +58,7 @@ parse_env_string(const char *str, void *result, char **errmsg)
        char **value = (char **)result;
        free(*value);
        *value = subst_env_in_string(str, errmsg);
-       return *value;
+       return *value != NULL;
 }
 
 static bool
index 5a8d8aa..cd71d5f 100755 (executable)
--- a/configure
+++ b/configure
@@ -639,8 +639,6 @@ CC
 test_suites
 include_dev_mk
 extra_libs
-extra_ldflags
-extra_cppflags
 host_os
 host_vendor
 host_cpu
@@ -2326,7 +2324,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 case $host in
-    *mingw32* | *cygwin* | *wince* | *mingwce*)
+    *mingw32* | *mingw64* | *cygwin* | *wince* | *mingwce*)
         windows_os=yes
 
 $as_echo "#define _WIN32_WINNT 0x0600" >>confdefs.h
@@ -2338,8 +2336,6 @@ esac
 
 
 
-
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5677,16 +5673,15 @@ $as_echo "$as_me: using bundled zlib as requested" >&6;}
 fi
 
 if test x${use_bundled_zlib} = xyes; then
-    extra_cppflags="-I\$(srcdir)/zlib"
-    extra_ldflags="-Lzlib"
+    CPPFLAGS="$CPPFLAGS -I\$(srcdir)/zlib"
     extra_libs="zlib/libz.a"
     mkdir -p zlib
 else
-    extra_libs="-lz"
+    LIBS="$LIBS -lz"
 fi
 
 if test x${windows_os} = xyes; then
-    extra_ldflags="$extra_ldflags -lws2_32"
+    LIBS="$LIBS -lws2_32"
 fi
 
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
index 8d8ce92..af56dca 100644 (file)
@@ -10,14 +10,12 @@ AC_CONFIG_HEADER(config.h)
 AC_CANONICAL_HOST
 
 case $host in
-    *mingw32* | *cygwin* | *wince* | *mingwce*)
+    *mingw32* | *mingw64* | *cygwin* | *wince* | *mingwce*)
         windows_os=yes
         AC_DEFINE(_WIN32_WINNT,0x0600, Windows Vista or newer is required)
         ;;
 esac
 
-AC_SUBST(extra_cppflags)
-AC_SUBST(extra_ldflags)
 AC_SUBST(extra_libs)
 AC_SUBST(include_dev_mk)
 AC_SUBST(test_suites)
@@ -115,17 +113,16 @@ else
 fi
 
 if test x${use_bundled_zlib} = xyes; then
-    extra_cppflags="-I\$(srcdir)/zlib"
-    extra_ldflags="-Lzlib"
+    CPPFLAGS="$CPPFLAGS -I\$(srcdir)/zlib"
     extra_libs="zlib/libz.a"
     mkdir -p zlib
 else
-    extra_libs="-lz"
+    LIBS="$LIBS -lz"
 fi
 
 dnl Linking on Windows needs ws2_32
 if test x${windows_os} = xyes; then
-    extra_ldflags="$extra_ldflags -lws2_32"
+    LIBS="$LIBS -lws2_32"
 fi
 
 AC_C_BIGENDIAN
index f48e67c..608a8f4 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -223,18 +223,21 @@ win32execute(char *path, char **argv, int doreturn,
 /* Execute a compiler backend, capturing all output to the given paths the full
  * path to the compiler to run is in argv[0]. */
 int
-execute(char **argv, int fd_out, int fd_err)
+execute(char **argv, int fd_out, int fd_err, pid_t *pid)
 {
-       pid_t pid;
        int status;
 
        cc_log_argv("Executing ", argv);
-       pid = fork();
-       if (pid == -1) {
+
+       block_signals();
+       *pid = fork();
+       unblock_signals();
+
+       if (*pid == -1) {
                fatal("Failed to fork: %s", strerror(errno));
        }
 
-       if (pid == 0) {
+       if (*pid == 0) {
                /* Child. */
                dup2(fd_out, 1);
                close(fd_out);
@@ -246,10 +249,14 @@ execute(char **argv, int fd_out, int fd_err)
        close(fd_out);
        close(fd_err);
 
-       if (waitpid(pid, &status, 0) != pid) {
+       if (waitpid(*pid, &status, 0) != *pid) {
                fatal("waitpid failed: %s", strerror(errno));
        }
 
+       block_signals();
+       *pid = 0;
+       unblock_signals();
+
        if (WEXITSTATUS(status) == 0 && WIFSIGNALED(status)) {
                return -1;
        }
index 78c4a7d..77d6cc2 100644 (file)
@@ -149,7 +149,7 @@ extension_for_language(const char *language)
 bool
 language_is_supported(const char *language)
 {
-       return p_language_for_language(language);
+       return p_language_for_language(language) != NULL;
 }
 
 bool
diff --git a/stats.c b/stats.c
index d6f428e..2d35ec9 100644 (file)
--- a/stats.c
+++ b/stats.c
@@ -391,7 +391,7 @@ stats_get_obsolete_limits(const char *dir, unsigned *maxfiles,
 
 /* set the per directory sizes */
 void
-stats_set_sizes(const char *dir, size_t num_files, size_t total_size)
+stats_set_sizes(const char *dir, unsigned num_files, uint64_t total_size)
 {
        struct counters *counters = counters_init(STATS_END);
        char *statsfile;
index 0692dcd..ca17b49 100644 (file)
--- a/system.h
+++ b/system.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2014 Joel Rosdahl
+ * Copyright (C) 2010-2015 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -44,6 +44,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <time.h>
 #include <unistd.h>
 #include <utime.h>
index 5f75654..0ecefd1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2013 Joel Rosdahl
+ * Copyright (C) 2010-2015 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -127,7 +127,7 @@ TEST(sysroot_should_be_rewritten_if_basedir_is_used)
        orig = args_init_from_string(arg_string);
 
        CHECK(cc_process_args(orig, &act_cpp, &act_cc));
-       CHECK(str_startswith(act_cpp->argv[1], "--sysroot=./foo"));
+       CHECK_STR_EQ(act_cpp->argv[1], "--sysroot=./foo");
 
        args_free(orig);
        args_free(act_cpp);
@@ -278,7 +278,7 @@ TEST(fprofile_flag_with_existing_dir_should_be_rewritten_to_real_path)
        args_free(orig);
 }
 
-TEST(fprofile_flag_with_nonexisting_dir_not_be_rewritten)
+TEST(fprofile_flag_with_nonexisting_dir_should_not_be_rewritten)
 {
        struct args *orig = args_init_from_string(
          "gcc -c -fprofile-generate=some/dir foo.c");
index ce9ad44..3842fab 100644 (file)
@@ -60,6 +60,20 @@ TEST(common_dir_prefix_length)
 
 TEST(get_relative_path)
 {
+#ifdef _WIN32
+       CHECK_STR_EQ_FREE2("a", get_relative_path("C:/doesn't matter", "a"));
+       CHECK_STR_EQ_FREE2("a/b", get_relative_path("C:/doesn't matter", "a/b"));
+       CHECK_STR_EQ_FREE2(".", get_relative_path("C:/a", "C:/a"));
+       CHECK_STR_EQ_FREE2("..", get_relative_path("C:/a/b", "C:/a"));
+       CHECK_STR_EQ_FREE2("b", get_relative_path("C:/a", "C:/a/b"));
+       CHECK_STR_EQ_FREE2("b/c", get_relative_path("C:/a", "C:/a/b/c"));
+       CHECK_STR_EQ_FREE2("../c", get_relative_path("C:/a/b", "C:/a/c"));
+       CHECK_STR_EQ_FREE2("../c/d", get_relative_path("C:/a/b", "C:/a/c/d"));
+       CHECK_STR_EQ_FREE2("../../c/d", get_relative_path("C:/a/b/c", "C:/a/c/d"));
+       CHECK_STR_EQ_FREE2("../..", get_relative_path("C:/a/b", "C:/"));
+       CHECK_STR_EQ_FREE2("../../c", get_relative_path("C:/a/b", "C:/c"));
+       CHECK_STR_EQ_FREE2("a/b", get_relative_path("C:/", "C:/a/b"));
+#else
        CHECK_STR_EQ_FREE2("a", get_relative_path("/doesn't matter", "a"));
        CHECK_STR_EQ_FREE2("a/b", get_relative_path("/doesn't matter", "a/b"));
        CHECK_STR_EQ_FREE2(".", get_relative_path("/a", "/a"));
@@ -72,6 +86,7 @@ TEST(get_relative_path)
        CHECK_STR_EQ_FREE2("../..", get_relative_path("/a/b", "/"));
        CHECK_STR_EQ_FREE2("../../c", get_relative_path("/a/b", "/c"));
        CHECK_STR_EQ_FREE2("a/b", get_relative_path("/", "/a/b"));
+#endif
 }
 
 TEST(format_hash_as_string)
diff --git a/util.c b/util.c
index 2526bbe..739e3af 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1342,13 +1342,20 @@ get_relative_path(const char *from, const char *to)
        const char *p;
        char *result;
 
-       assert(from && from[0] == '/');
+       assert(from && is_absolute_path(from));
        assert(to);
 
-       if (!*to || *to != '/') {
+       if (!*to || !is_absolute_path(to)) {
                return x_strdup(to);
        }
 
+#ifdef _WIN32
+       // Both paths are absolute, drop the drive letters
+       assert(from[0] == to[0]); // Assume the same drive letter
+       from += 2;
+       to += 2;
+#endif
+
        result = x_strdup("");
        common_prefix_len = common_dir_prefix_length(from, to);
        if (common_prefix_len > 0 || !str_eq(from, "/")) {
@@ -1638,7 +1645,7 @@ expand_variable(const char **str, char **result, char **errmsg)
        if (curly) {
                if (*q != '}') {
                        *errmsg = format("syntax error: missing '}' after \"%s\"", p);
-                       return NULL;
+                       return false;
                }
        }
 
index 44e2ca0..710ffe5 100644 (file)
--- a/version.c
+++ b/version.c
@@ -1 +1 @@
-const char CCACHE_VERSION[] = "3.2.3";
+const char CCACHE_VERSION[] = "3.2.4";