diff --git a/src/java.base/share/native/libzip/zlib/gzwrite.c b/src/java.base/share/native/libzip/zlib/gzwrite.c index 7a73b7cadf3..734de14b7b2 100644 --- a/src/java.base/share/native/libzip/zlib/gzwrite.c +++ b/src/java.base/share/native/libzip/zlib/gzwrite.c @@ -399,6 +399,18 @@ int ZEXPORT gzputs(file, str) #if defined(STDC) || defined(Z_HAVE_STDARG_H) #include +#define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push") +#define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop") +#define PRAGMA_DISABLE_GCC_WARNING_AUX(x) _Pragma(#x) +#define PRAGMA_DISABLE_GCC_WARNING(option_string) \ + PRAGMA_DISABLE_GCC_WARNING_AUX(GCC diagnostic ignored option_string) +#define PRAGMA_FORMAT_NONLITERAL_IGNORED \ + PRAGMA_DISABLE_GCC_WARNING("-Wformat-nonliteral") \ + PRAGMA_DISABLE_GCC_WARNING("-Wformat-security") + +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED + /* -- see zlib.h -- */ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) { @@ -483,6 +495,8 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) return ret; } +PRAGMA_DIAG_POP + #else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ diff --git a/src/java.base/share/native/libzip/zlib/zconf.h b/src/java.base/share/native/libzip/zlib/zconf.h index 9b920116be8..3aaa4101a1e 100644 --- a/src/java.base/share/native/libzip/zlib/zconf.h +++ b/src/java.base/share/native/libzip/zlib/zconf.h @@ -499,9 +499,7 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H -#endif #ifndef Z_SOLO # if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */