]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add some Windows/MinGW ifdefs, to make it build
authorAnders Björklund <anders@itension.se>
Tue, 16 Feb 2016 20:06:38 +0000 (21:06 +0100)
committerAnders Björklund <anders@itension.se>
Thu, 18 Feb 2016 22:31:50 +0000 (23:31 +0100)
ccache.c
ccache.h
snprintf.c
test/framework.c
test/test_conf.c

index 370c68cbda968c48d182fb94455d5da47bb5008a..f1f1de7866b295d4facf3a0ecedfa2cc9b0f10a1 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -251,11 +251,13 @@ struct pending_tmp_file {
 /* Temporary files to remove at program exit. */
 static struct pending_tmp_file *pending_tmp_files = NULL;
 
+#ifndef _WIN32
 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;
+#endif
 
 /*
  * This is a string that identifies the current "version" of the hash sum
@@ -335,15 +337,19 @@ temp_dir()
 void
 block_signals(void)
 {
+#ifndef _WIN32
        sigprocmask(SIG_BLOCK, &fatal_signal_set, NULL);
+#endif
 }
 
 void
 unblock_signals(void)
 {
+#ifndef _WIN32
        sigset_t empty;
        sigemptyset(&empty);
        sigprocmask(SIG_SETMASK, &empty, NULL);
+#endif
 }
 
 static void
@@ -380,6 +386,7 @@ clean_up_pending_tmp_files(void)
        unblock_signals();
 }
 
+#ifndef _WIN32
 static void
 signal_handler(int signum)
 {
@@ -440,6 +447,7 @@ set_up_signal_handlers(void)
        register_signal_handler(SIGQUIT);
 #endif
 }
+#endif /* _WIN32 */
 
 static void
 clean_up_internal_tempdir(void)
@@ -3125,7 +3133,9 @@ ccache(int argc, char *argv[])
        /* Arguments to send to the real compiler. */
        struct args *compiler_args;
 
+#ifndef _WIN32
        set_up_signal_handlers();
+#endif
 
        orig_args = args_init(argc, argv);
 
index 8218160b51daf2838de6dcefef2654b1aac755a5..3c4c1e7e0c625e686d6bf907b9d7a094c67d68e8 100644 (file)
--- a/ccache.h
+++ b/ccache.h
@@ -272,7 +272,7 @@ void add_exe_ext_if_no_to_fullpath(char *full_path_win_ext, size_t max_size,
 #    define link(src,dst) (CreateHardLink(dst,src,NULL) ? 0 : -1)
 #    define lstat(a,b) stat(a,b)
 #    define execv(a,b) win32execute(a,b,0,-1,-1)
-#    define execute(a,b,c) win32execute(*(a),a,1,b,c)
+#    define execute(a,b,c,d) win32execute(*(a),a,1,b,c)
 #    define DIR_DELIM_CH '/'
 #    define PATH_DELIM ";"
 #    define F_RDLCK 0
index e1b86f2863dbaed86fc62a0d46689a7aba327c32..b935ee930e34dfb5bf30bbcd6e5d600c25612042 100644 (file)
@@ -539,7 +539,9 @@ static UINTMAX_T cast(LDOUBLE);
 static UINTMAX_T myround(LDOUBLE);
 static LDOUBLE mypow10(int);
 
+#ifndef __MINGW32__
 extern int errno;
+#endif
 
 int
 rpl_vsnprintf(char *str, size_t size, const char *format, va_list args)
index c15e2f025237d657b5c1efecae7b421a731ac1c7..44f0c7d60c2e769a98c04a32c4ab54aa1877e732 100644 (file)
@@ -180,7 +180,7 @@ cct_check_int_eq(const char *file, int line, const char *expression,
                cct_check_passed(file, line, expression);
                return true;
        } else {
-#ifdef HAVE_LONG_LONG
+#if defined(HAVE_LONG_LONG) && !defined(__MINGW32__)
                char *exp_str = format("%lld", (long long)expected);
                char *act_str = format("%lld", (long long)actual);
 #else
index b93dbdd10a6e1d2e0660115426b1be99b284640a..749859ab3da15b3b0647b6d62ecc72d05367dae6 100644 (file)
@@ -389,7 +389,11 @@ TEST(conf_print_items)
 
        conf.item_origins = x_malloc(N_CONFIG_ITEMS * sizeof(char *));
        for (i = 0; i < N_CONFIG_ITEMS; ++i) {
+#ifndef __MINGW32__
                conf.item_origins[i] = format("origin%zu", i);
+#else
+               conf.item_origins[i] = format("origin%u", (unsigned) i);
+#endif
        }
 
        conf_print_items(&conf, conf_item_receiver, NULL);
@@ -429,7 +433,11 @@ TEST(conf_print_items)
        CHECK_STR_EQ("unify = true", received_conf_items[n++].descr);
 
        for (i = 0; i < N_CONFIG_ITEMS; ++i) {
+#ifndef __MINGW32__
                char *expected = format("origin%zu", i);
+#else
+               char *expected = format("origin%u", (unsigned) i);
+#endif
                CHECK_STR_EQ_FREE1(expected, received_conf_items[i].origin);
        }