From: Anders Björklund Date: Tue, 16 Feb 2016 20:06:38 +0000 (+0100) Subject: Add some Windows/MinGW ifdefs, to make it build X-Git-Tag: v3.3~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=361d9ad46d3276148f5b64654bb775205b728318;p=thirdparty%2Fccache.git Add some Windows/MinGW ifdefs, to make it build --- diff --git a/ccache.c b/ccache.c index 370c68cbd..f1f1de786 100644 --- 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); diff --git a/ccache.h b/ccache.h index 8218160b5..3c4c1e7e0 100644 --- 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 diff --git a/snprintf.c b/snprintf.c index e1b86f286..b935ee930 100644 --- a/snprintf.c +++ b/snprintf.c @@ -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) diff --git a/test/framework.c b/test/framework.c index c15e2f025..44f0c7d60 100644 --- a/test/framework.c +++ b/test/framework.c @@ -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 diff --git a/test/test_conf.c b/test/test_conf.c index b93dbdd10..749859ab3 100644 --- a/test/test_conf.c +++ b/test/test_conf.c @@ -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); }