summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-03-13 23:19:38 -0700
committerMark Adler <madler@alumni.caltech.edu>2012-03-13 23:19:38 -0700
commit8dc21b17a626f4b0fb99c017fcbdf3ac20b35b32 (patch)
tree79416d76723aed9a33652794767b725f17bc30b8
parent9c08a822463664c204ff57a0a91abe727d7987c1 (diff)
downloadzlib-8dc21b17a626f4b0fb99c017fcbdf3ac20b35b32.tar.gz
zlib-8dc21b17a626f4b0fb99c017fcbdf3ac20b35b32.tar.bz2
zlib-8dc21b17a626f4b0fb99c017fcbdf3ac20b35b32.zip
Allow the use of -Wundef when compiling or using zlib.
-rw-r--r--zconf.h20
-rw-r--r--zconf.h.cmakein20
-rw-r--r--zconf.h.in20
-rw-r--r--zlib.h6
4 files changed, 45 insertions, 21 deletions
diff --git a/zconf.h b/zconf.h
index 57f25ad..0154955 100644
--- a/zconf.h
+++ b/zconf.h
@@ -399,24 +399,32 @@ typedef uLong FAR uLongf;
399# endif 399# endif
400#endif 400#endif
401 401
402/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and 402/* accommodate both "#define _LARGEFILE64_SOURCE" and
403 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even 403 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
404 * though the former does not conform to the LFS document), but considering 404 * though the former does not conform to the LFS document), but consider
405 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as 405 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
406 * equivalently requesting no 64-bit operations 406 * equivalently requesting no 64-bit operations
407 */ 407 */
408#if -_LARGEFILE64_SOURCE - -1 == 1 408#if defined(LARGEFILE64_SOURCE) && _LARGEFILE64_SOURCE == 0
409# undef _LARGEFILE64_SOURCE 409# undef _LARGEFILE64_SOURCE
410#endif 410#endif
411 411
412#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 412#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE == 1
413# define Z_LARGE 413# define Z_LFS64
414#endif
415
416#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
417# define Z_LARGE64
418#endif
419
420#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 && defined(Z_LFS64)
421# define Z_WANT64
414#endif 422#endif
415 423
416#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) 424#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
417# define Z_HAVE_UNISTD_H 425# define Z_HAVE_UNISTD_H
418#endif 426#endif
419#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)) && !defined(Z_SOLO) 427#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE64)) && !defined(Z_SOLO)
420# include <unistd.h> /* for SEEK_* and off_t */ 428# include <unistd.h> /* for SEEK_* and off_t */
421# ifdef VMS 429# ifdef VMS
422# include <unixio.h> /* for off_t */ 430# include <unixio.h> /* for off_t */
diff --git a/zconf.h.cmakein b/zconf.h.cmakein
index dd2d28a..af4e92e 100644
--- a/zconf.h.cmakein
+++ b/zconf.h.cmakein
@@ -401,24 +401,32 @@ typedef uLong FAR uLongf;
401# endif 401# endif
402#endif 402#endif
403 403
404/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and 404/* accommodate both "#define _LARGEFILE64_SOURCE" and
405 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even 405 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
406 * though the former does not conform to the LFS document), but considering 406 * though the former does not conform to the LFS document), but consider
407 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as 407 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
408 * equivalently requesting no 64-bit operations 408 * equivalently requesting no 64-bit operations
409 */ 409 */
410#if -_LARGEFILE64_SOURCE - -1 == 1 410#if defined(LARGEFILE64_SOURCE) && _LARGEFILE64_SOURCE == 0
411# undef _LARGEFILE64_SOURCE 411# undef _LARGEFILE64_SOURCE
412#endif 412#endif
413 413
414#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 414#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE == 1
415# define Z_LARGE 415# define Z_LFS64
416#endif
417
418#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
419# define Z_LARGE64
420#endif
421
422#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 && defined(Z_LFS64)
423# define Z_WANT64
416#endif 424#endif
417 425
418#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) 426#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
419# define Z_HAVE_UNISTD_H 427# define Z_HAVE_UNISTD_H
420#endif 428#endif
421#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)) && !defined(Z_SOLO) 429#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE64)) && !defined(Z_SOLO)
422# include <unistd.h> /* for SEEK_* and off_t */ 430# include <unistd.h> /* for SEEK_* and off_t */
423# ifdef VMS 431# ifdef VMS
424# include <unixio.h> /* for off_t */ 432# include <unixio.h> /* for off_t */
diff --git a/zconf.h.in b/zconf.h.in
index 57f25ad..0154955 100644
--- a/zconf.h.in
+++ b/zconf.h.in
@@ -399,24 +399,32 @@ typedef uLong FAR uLongf;
399# endif 399# endif
400#endif 400#endif
401 401
402/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and 402/* accommodate both "#define _LARGEFILE64_SOURCE" and
403 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even 403 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
404 * though the former does not conform to the LFS document), but considering 404 * though the former does not conform to the LFS document), but consider
405 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as 405 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
406 * equivalently requesting no 64-bit operations 406 * equivalently requesting no 64-bit operations
407 */ 407 */
408#if -_LARGEFILE64_SOURCE - -1 == 1 408#if defined(LARGEFILE64_SOURCE) && _LARGEFILE64_SOURCE == 0
409# undef _LARGEFILE64_SOURCE 409# undef _LARGEFILE64_SOURCE
410#endif 410#endif
411 411
412#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 412#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE == 1
413# define Z_LARGE 413# define Z_LFS64
414#endif
415
416#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
417# define Z_LARGE64
418#endif
419
420#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 && defined(Z_LFS64)
421# define Z_WANT64
414#endif 422#endif
415 423
416#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) 424#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
417# define Z_HAVE_UNISTD_H 425# define Z_HAVE_UNISTD_H
418#endif 426#endif
419#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)) && !defined(Z_SOLO) 427#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE64)) && !defined(Z_SOLO)
420# include <unistd.h> /* for SEEK_* and off_t */ 428# include <unistd.h> /* for SEEK_* and off_t */
421# ifdef VMS 429# ifdef VMS
422# include <unixio.h> /* for off_t */ 430# include <unixio.h> /* for off_t */
diff --git a/zlib.h b/zlib.h
index ca6123c..bb07e2a 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1668,7 +1668,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1668 * functions are changed to 64 bits) -- in case these are set on systems 1668 * functions are changed to 64 bits) -- in case these are set on systems
1669 * without large file support, _LFS64_LARGEFILE must also be true 1669 * without large file support, _LFS64_LARGEFILE must also be true
1670 */ 1670 */
1671#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 1671#ifdef Z_LARGE64
1672 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1672 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
1673 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); 1673 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
1674 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); 1674 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
@@ -1677,7 +1677,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1677 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); 1677 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
1678#endif 1678#endif
1679 1679
1680#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 1680#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
1681# ifdef Z_PREFIX_SET 1681# ifdef Z_PREFIX_SET
1682# define z_gzopen z_gzopen64 1682# define z_gzopen z_gzopen64
1683# define z_gzseek z_gzseek64 1683# define z_gzseek z_gzseek64
@@ -1693,7 +1693,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1693# define adler32_combine adler32_combine64 1693# define adler32_combine adler32_combine64
1694# define crc32_combine crc32_combine64 1694# define crc32_combine crc32_combine64
1695# endif 1695# endif
1696# ifndef _LARGEFILE64_SOURCE 1696# ifndef Z_LARGE64
1697 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1697 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
1698 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); 1698 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
1699 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); 1699 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));