]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Minor fixes for cygwin/msys2
authorRafael Kitover <rkitover@gmail.com>
Tue, 25 Sep 2018 23:55:35 +0000 (16:55 -0700)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 13 Oct 2018 11:55:31 +0000 (13:55 +0200)
Add -Wno-error=implicit-fallthrough, if the compiler supports it,  to
dev.mk so that zlib will compile with -Werror.

Disable -Wdeprecated-declarations in the mkstemp() shim in util.c so
that it compiles with -Werror.

Stop assuming that mkstemp() is broken on cygwin, I could not find any
documentation for this.

Fix a couple of erroneous checks in zlib that assume cygwin is the same
as win32.

configure.ac
dev.mk.in
src/ccache.h
src/util.c
src/zlib/gzguts.h
src/zlib/zlib.h
src/zlib/zutil.h

index 9a21ee1fcbef53b069d3294177d0f02091dcdd29..5481e113577ab44e5820159bc4e402dc63c4a3e8 100644 (file)
@@ -17,6 +17,7 @@ case $host in
 esac
 
 AC_SUBST(extra_libs)
+AC_SUBST(extra_cflags)
 AC_SUBST(getopt_long_c)
 AC_SUBST(include_dev_mk)
 AC_SUBST(test_suites)
@@ -198,6 +199,17 @@ if test ! -f $srcdir/dev_mode_disabled && test "$RUN_FROM_BUILD_FARM" != yes; th
     include_dev_mk='include dev.mk'
     version=`(git --git-dir=$srcdir/.git describe --dirty 2>/dev/null || echo vunknown) | sed -e 's/v//' -e 's/-/+/' -e 's/-/_/g'`
     echo "extern const char CCACHE_VERSION@<:@@:>@; const char CCACHE_VERSION@<:@@:>@ = \"$version\";" >src/version.c
+
+    dnl Check for -Wimplicit-fallthrough and disable if exists
+    AC_MSG_CHECKING([whether C compiler supports -Wimplicit-fallthrough])
+    saved_cflags=$CFLAGS
+    CFLAGS=-Wimplicit-fallthrough
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+        [AC_MSG_RESULT([yes])]
+        [extra_cflags="-Wno-error=implicit-fallthrough"],
+        [AC_MSG_RESULT([no])]
+    )
+    CFLAGS=$saved_cflags
 else
     AC_MSG_NOTICE(developer mode disabled)
 fi
index 4ca34a465869a4c07569091d677fef52e0a64736..9bd341ec08413ee53bc62d87989f671af780fd32 100644 (file)
--- a/dev.mk.in
+++ b/dev.mk.in
@@ -1,6 +1,6 @@
 # GNU make syntax reigns in this file.
 
-all_cflags += -Werror
+all_cflags += -Werror @extra_cflags@
 all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d
 
 A2X = a2x
index 1c769f8251c1d9787a8d10e9169bd94ed69cea7c..091662121ef1eedf726fdc47fd6dc00bc93b9e82 100644 (file)
@@ -277,11 +277,6 @@ typedef int (*COMPAR_FN_T)(const void *, const void *);
 #define O_BINARY 0
 #endif
 
-// mkstemp() on some versions of cygwin don't handle binary files, so override.
-#ifdef __CYGWIN__
-#undef HAVE_MKSTEMP
-#endif
-
 #ifdef _WIN32
 char *win32argvtos(char *prefix, char **argv);
 char *win32getshell(char *path);
index 51c5857811068a0347d796963c494a9132cd7d76..04d0640d86fda16905cedb5d886df6c924336abf 100644 (file)
@@ -273,7 +273,14 @@ copy_fd(int fd_in, int fd_out)
 int
 mkstemp(char *template)
 {
+#ifdef __GNUC__
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
        mktemp(template);
+#ifdef __GNUC__
+    #pragma GCC diagnostic pop
+#endif
        return open(template, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
 }
 #endif
index 990a4d2514933709883a7d949ed52146675fe2c1..6378d468a258b134420c2434f62de8f0d3fb42ea 100644 (file)
@@ -39,7 +39,7 @@
 #  include <io.h>
 #endif
 
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
 #  define WIDECHAR
 #endif
 
index f09cdaf1e0543de911d8220befdb51fa8632a9e6..49dfcece0e1f9a5ccf5298a633045a7bcfb1bf25 100644 (file)
@@ -1893,7 +1893,7 @@ ZEXTERN int            ZEXPORT inflateValidate OF((z_streamp, int));
 ZEXTERN unsigned long  ZEXPORT inflateCodesUsed OF ((z_streamp));
 ZEXTERN int            ZEXPORT inflateResetKeep OF((z_streamp));
 ZEXTERN int            ZEXPORT deflateResetKeep OF((z_streamp));
-#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
+#if defined(_WIN32) && !defined(Z_SOLO)
 ZEXTERN gzFile         ZEXPORT gzopen_w OF((const wchar_t *path,
                                             const char *mode));
 #endif
index b079ea6a80f5abd23a6b2451d6eaee50ceda969b..3f0bc2de4a37331854009f940b0ea6e0677ed17e 100644 (file)
@@ -147,7 +147,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
 #  define OS_CODE 13
 #endif
 
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(WIN32)
 #  define OS_CODE  10
 #endif