[libpng12] Quiet unused variable warnings from clang by porting PNG_UNUSED()

from libpng-1.4.6.
This commit is contained in:
Glenn Randers-Pehrson 2014-02-03 09:41:50 -06:00
parent 0cbe85bcfd
commit ae48296140
13 changed files with 81 additions and 55 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.2.51rc02 - January 30, 2014
Libpng 1.2.51rc03 - February 3, 2014
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@ -9,36 +9,36 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
libpng-1.2.51rc02.tar.xz (LZMA-compressed, recommended)
libpng-1.2.51rc02.tar.gz
libpng-1.2.51rc02.tar.bz2
libpng-1.2.51rc03.tar.xz (LZMA-compressed, recommended)
libpng-1.2.51rc03.tar.gz
libpng-1.2.51rc03.tar.bz2
Source files with LF line endings (for Unix/Linux) without the
"configure" script
libpng-1.2.51rc02-no-config.tar.xz (LZMA-compressed, recommended)
libpng-1.2.51rc02-no-config.tar.gz
libpng-1.2.51rc02-no-config.tar.bz2
libpng-1.2.51rc03-no-config.tar.xz (LZMA-compressed, recommended)
libpng-1.2.51rc03-no-config.tar.gz
libpng-1.2.51rc03-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp1251r02.zip
lp1251r02.7z
lp1251r02.tar.bz2
lp1251r03.zip
lp1251r03.7z
lp1251r03.tar.bz2
Project files
libpng-1.2.51rc02-project-netware.zip
libpng-1.2.51rc02-project-wince.zip
libpng-1.2.51rc03-project-netware.zip
libpng-1.2.51rc03-project-wince.zip
Other information:
libpng-1.2.51rc02-README.txt
libpng-1.2.51rc02-KNOWNBUGS.txt
libpng-1.2.51rc02-LICENSE.txt
libpng-1.2.51rc02-Y2K-compliance.txt
libpng-1.2.51rc02-[previous version]-diff.txt
libpng-1.2.51rc03-README.txt
libpng-1.2.51rc03-KNOWNBUGS.txt
libpng-1.2.51rc03-LICENSE.txt
libpng-1.2.51rc03-Y2K-compliance.txt
libpng-1.2.51rc03-[previous version]-diff.txt
Changes since the last public release (1.2.50):
@ -69,6 +69,12 @@ version 1.2.51rc01 [January 28, 2014]
version 1.2.51rc02 [January 30, 2014]
Quiet an uninitialized memory warning from VC2013 in png_get_png().
version 1.2.51rc03 [February 3, 2014]
Quiet unused variable warnings from clang by porting PNG_UNUSED() from 1.4.6.
version 1.0.61 and 1.2.51 [February 3, 2014]
No changes.
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net

View File

@ -2804,6 +2804,12 @@ version 1.2.51rc01 [January 28, 2014]
version 1.2.51rc02 [January 30, 2014]
Quiet an uninitialized memory warning from VC2013 in png_get_png().
version 1.2.51rc03 [February 3, 2014]
Quiet unused variable warnings from clang by porting PNG_UNUSED() from 1.4.6.
version 1.0.61 and 1.2.51 [February 3, 2014]
No changes.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

16
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.2.51 [January 30, 2014]
* Last changed in libpng 1.2.51 [February 3, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -17,7 +17,7 @@
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_2_51rc02 Your_png_h_is_not_version_1_2_51rc02;
typedef version_1_2_51rc03 Your_png_h_is_not_version_1_2_51rc03;
/* Version information for C files. This had better match the version
* string defined in png.h.
@ -718,19 +718,19 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT
#else
#ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
"libpng version 1.2.51rc02 - January 30, 2014" PNG_STRING_NEWLINE \
"libpng version 1.2.51rc03 - February 3, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE);
#else
return ((png_charp) "libpng version 1.2.51rc02 - January 30, 2014\
return ((png_charp) "libpng version 1.2.51rc03 - February 3, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
@ -750,7 +750,7 @@ png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
@ -758,7 +758,7 @@ png_charp PNGAPI
png_get_header_ver(png_structp png_ptr)
{
/* Version of *.h files used when building libpng */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
@ -766,7 +766,7 @@ png_charp PNGAPI
png_get_header_version(png_structp png_ptr)
{
/* Returns longer string containing both version and date */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef __STDC__
return ((png_charp) PNG_HEADER_VERSION_STRING
#ifndef PNG_READ_SUPPORTED

22
png.h
View File

@ -1,6 +1,6 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.2.51rc02 - January 30, 2014
* libpng version 1.2.51rc03 - February 3, 2014
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -10,7 +10,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.2.51rc02 - January 30, 2014: Glenn
* libpng versions 0.97, January 1998, through 1.2.51rc03 - February 3, 2014: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -285,7 +285,9 @@
* 1.0.60 10 10060 10.so.0.60[.0]
* 1.2.50 13 10250 12.so.0.50[.0]
* 1.2.51beta01-05 13 10251 12.so.0.51[.0]
* 1.2.51rc01-02 13 10251 12.so.0.51[.0]
* 1.2.51rc01-03 13 10251 12.so.0.51[.0]
* 1.0.61 10 10061 10.so.0.61[.0]
* 1.2.51 13 10251 12.so.0.51[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@ -317,7 +319,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.2.51rc02, January 30, 2014, are
* libpng versions 1.2.6, August 15, 2004, through 1.2.51rc03, February 3, 2014, are
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -429,13 +431,13 @@
* Y2K compliance in libpng:
* =========================
*
* January 30, 2014
* February 3, 2014
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.2.51rc02 are Y2K compliant. It is my belief that earlier
* upward through 1.2.51rc03 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@ -491,9 +493,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.2.51rc02"
#define PNG_LIBPNG_VER_STRING "1.2.51rc03"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.2.51rc02 - January 30, 2014\n"
" libpng version 1.2.51rc03 - February 3, 2014\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@ -506,7 +508,7 @@
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
#define PNG_LIBPNG_VER_BUILD 02
#define PNG_LIBPNG_VER_BUILD 03
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
@ -1571,7 +1573,7 @@ struct png_struct_def
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef png_structp version_1_2_51rc02;
typedef png_structp version_1_2_51rc03;
typedef png_struct FAR * FAR * png_structpp;

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.2.51rc02 - January 30, 2014
* libpng version 1.2.51rc03 - February 3, 2014
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -86,6 +86,18 @@
#endif
/* End of material added at libpng-1.2.19/1.2.21 */
/* Added at libpng-1.2.51 (ported from 1.4.6) */
#ifndef PNG_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely). Note that if you replace
* it with something other than whitespace, you must include the terminating
* semicolon.
*/
# define PNG_UNUSED(param) (void)param;
#endif
/* End of material added to libpng-1.4.6 */
/* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your
* machine. One of these will be allocated per png_struct. When this

View File

@ -300,7 +300,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
/* Here if not setjmp support or if png_ptr is null. */
PNG_ABORT();
#ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */
PNG_UNUSED(error_message) /* Make compiler happy */
#endif
}
@ -346,9 +346,9 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
warning_message = warning_message; /* Make compiler happy */
PNG_UNUSED(warning_message) /* Make compiler happy */
#endif
png_ptr = png_ptr; /* Make compiler happy */
PNG_UNUSED(png_ptr) /* Make compiler happy */
}
#endif /* PNG_WARNINGS_SUPPORTED */

View File

@ -893,7 +893,7 @@ png_uint_32 PNGAPI
png_get_asm_flagmask (int flag_select)
{
/* Obsolete, to be removed from libpng-1.4.0 */
flag_select=flag_select;
PNG_UNUSED(flag_select)
return 0L;
}
@ -903,7 +903,7 @@ png_uint_32 PNGAPI
png_get_mmx_flagmask (int flag_select, int *compilerID)
{
/* Obsolete, to be removed from libpng-1.4.0 */
flag_select=flag_select;
PNG_UNUSED(flag_select)
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
return 0L;
}

View File

@ -1500,8 +1500,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
transforms = transforms; /* Quiet compiler warnings */
params = params;
PNG_UNUSED(transforms) /* Quiet compiler warnings */
PNG_UNUSED(params);
}
#endif /* PNG_INFO_IMAGE_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.2.51 [January 30, 2014]
* Last changed in libpng 1.2.51 [February 3, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@ -659,7 +659,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
png_crc_finish(png_ptr, length);
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
}
#ifdef PNG_READ_gAMA_SUPPORTED
@ -2465,7 +2465,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_finish(png_ptr, skip);
#ifndef PNG_READ_USER_CHUNKS_SUPPORTED
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
#endif
}
@ -2921,7 +2921,7 @@ png_do_read_interlace(png_structp png_ptr)
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
}
#ifndef PNG_READ_PACKSWAP_SUPPORTED
transformations = transformations; /* Silence compiler warning */
PNG_UNUSED(transformations) /* Silence compiler warning */
#endif
}
#endif /* PNG_READ_INTERLACING_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.2.51 [January 30, 2014]
* Last changed in libpng 1.2.51 [February 3, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -1187,7 +1187,7 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
if (png_ptr != NULL)
png_ptr->asm_flags = 0;
asm_flags = asm_flags; /* Quiet the compiler */
PNG_UNUSED(asm_flags) /* Quiet the compiler */
}
/* This function was added to libpng 1.2.0 */
@ -1200,8 +1200,8 @@ png_set_mmx_thresholds (png_structp png_ptr,
if (png_ptr == NULL)
return;
/* Quiet the compiler */
mmx_bitdepth_threshold = mmx_bitdepth_threshold;
mmx_rowbytes_threshold = mmx_rowbytes_threshold;
PNG_UNUSED(mmx_bitdepth_threshold)
PNG_UNUSED(mmx_rowbytes_threshold)
}
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */

View File

@ -382,7 +382,7 @@ static void
pngtest_flush(png_structp png_ptr)
{
/* Do nothing; fflush() is said to be just a waste of energy. */
png_ptr = png_ptr; /* Stifle compiler warning */
PNG_UNUSED(png_ptr) /* Stifle compiler warning */
}
#endif
@ -1702,4 +1702,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_2_51rc02 your_png_h_is_not_version_1_2_51rc02;
typedef version_1_2_51rc03 your_png_h_is_not_version_1_2_51rc03;

View File

@ -1586,8 +1586,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
/* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end(png_ptr, info_ptr);
transforms = transforms; /* Quiet compiler warnings */
params = params;
PNG_UNUSED(transforms) /* Quiet compiler warnings */
PNG_UNUSED(params)
}
#endif
#endif /* PNG_WRITE_SUPPORTED */