[devel] Enabled 'attribute' warnings that are relevant to library APIs

and callbacks.
Changed rules for generation of the various symbol files and added a new
  rule for a DEF file (which is also added to the distribution).
Updated the symbol file generation to stop it adding spurious spaces
  to EOL (coming from preprocessor macro expansion).  Added a facility
  to join tokens in the output and rewrite *.dfn to use this.
This commit is contained in:
Glenn Randers-Pehrson 2010-03-12 21:03:18 -06:00
parent eae8e36ec4
commit a528fba7aa
10 changed files with 159 additions and 80 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.0beta14 - March 12, 2010
Libpng 1.5.0beta14 - March 13, 2010
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.
@ -97,7 +97,7 @@ version 1.5.0beta13 [March 10, 2010]
expressions (i.e. a trailing ';' must always be added) and correct
the format statements in various png_debug messages.
version 1.5.0beta14 [March 12, 2010]
version 1.5.0beta14 [March 13, 2010]
Removed direct access to png_ptr->io_ptr from the Windows code in pngtest.c
Revised Makefile.am to account for recent additions and replacements.
Corrected CE and OS/2 DEF files (scripts/png*def) for symbols removed and
@ -111,6 +111,12 @@ version 1.5.0beta14 [March 12, 2010]
and appropriate changes made to all files. Cygwin builds re-hinged to
allow procedure call standard changes and to remove the need for the DEF
file (fixes build on Cygwin).
Enabled 'attribute' warnings that are relevant to library APIs and callbacks.
Changed rules for generation of the various symbol files and added a new
rule for a DEF file (which is also added to the distribution).
Updated the symbol file generation to stop it adding spurious spaces
to EOL (coming from preprocessor macro expansion). Added a facility
to join tokens in the output and rewrite *.dfn to use this.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -2574,7 +2574,7 @@ version 1.5.0beta13 [March 10, 2010]
expressions (i.e. a trailing ';' must always be added) and correct
the format statements in various png_debug messages.
version 1.5.0beta14 [March 12, 2010]
version 1.5.0beta14 [March 13, 2010]
Removed direct access to png_ptr->io_ptr from the Windows code in pngtest.c
Revised Makefile.am to account for recent additions and replacements.
Corrected CE and OS/2 DEF files (scripts/png*def) for symbols removed and
@ -2588,6 +2588,12 @@ version 1.5.0beta14 [March 12, 2010]
and appropriate changes made to all files. Cygwin builds re-hinged to
allow procedure call standard changes and to remove the need for the DEF
file (fixes build on Cygwin).
Enabled 'attribute' warnings that are relevant to library APIs and callbacks.
Changed rules for generation of the various symbol files and added a new
rule for a DEF file (which is also added to the distribution).
Updated the symbol file generation to stop it adding spurious spaces
to EOL (coming from preprocessor macro expansion). Added a facility
to join tokens in the output and rewrite *.dfn to use this.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -29,7 +29,7 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngset.c pngget.c pngrutil
pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c \
png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
%HEADERS%
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
@ -46,9 +46,6 @@ else
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
endif
# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
#distribute headers in /usr/include/libpng/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
pkginclude_HEADERS= png.h pngconf.h
@ -72,13 +69,13 @@ EXTRA_DIST= \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
CMakeLists.txt example.c libpng-1.5.0beta14.txt
CMakeLists.txt example.c libpng.def libpng-@PNGLIB_VERSION@.txt
CLEANFILES= pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
libpng.sym
CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
config.sub configure depcomp install-sh ltmain.sh missing libpng.def
$(PNGLIB_BASENAME).pc: libpng.pc
cp libpng.pc $@
@ -86,21 +83,21 @@ $(PNGLIB_BASENAME).pc: libpng.pc
$(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@
libpng.sym: png.h pngconf.h
rm -f $@ $@.new
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
$(SED) -n -e \
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
>$@.new
mv $@.new $@
libpng.sym: scripts/sym.dfn png.h pngconf.h
libpng.vers: scripts/vers.dfn png.h pngconf.h
libpng.def: scripts/def.dfn png.h pngconf.h
libpng.vers: libpng.sym
rm -f $@ $@.new
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
$(SED) s/$$/\;/ libpng.sym >> $@.new
echo 'local: *; };' >> $@.new
mv $@.new $@
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'
libpng.sym libpng.vers libpng.def:
$(RM) -f $@ dfn.c dfn?.out
echo '#include "$<"' >dfn.c
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p' dfn1.out >dfn2.out
$(SED) -e 's| *@@@ *||' -e 's| *$$||' dfn2.out >dfn3.out
mv dfn3.out $@
test: check

View File

@ -303,7 +303,7 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngset.c pngget.c pngrutil
pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c \
png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
%HEADERS%
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined \
@ -312,9 +312,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined \
$(am__append_1) $(am__append_2)
@HAVE_LD_VERSION_SCRIPT_FALSE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
@HAVE_LD_VERSION_SCRIPT_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
pkginclude_HEADERS = png.h pngconf.h
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
@ -332,13 +329,17 @@ EXTRA_DIST = \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
CMakeLists.txt example.c libpng-1.5.0beta14.txt
CMakeLists.txt example.c libpng.def libpng-@PNGLIB_VERSION@.txt
CLEANFILES = pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
libpng.sym
CLEANFILES = dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
config.sub configure depcomp install-sh ltmain.sh missing libpng.def
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@ -1211,21 +1212,17 @@ $(PNGLIB_BASENAME).pc: libpng.pc
$(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@
libpng.sym: png.h pngconf.h
rm -f $@ $@.new
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
$(SED) -n -e \
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
>$@.new
mv $@.new $@
libpng.sym: scripts/sym.dfn png.h pngconf.h
libpng.vers: scripts/vers.dfn png.h pngconf.h
libpng.def: scripts/def.dfn png.h pngconf.h
libpng.vers: libpng.sym
rm -f $@ $@.new
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
$(SED) s/$$/\;/ libpng.sym >> $@.new
echo 'local: *; };' >> $@.new
mv $@.new $@
libpng.sym libpng.vers libpng.def:
$(RM) -f $@ dfn.c dfn?.out
echo '#include "$<"' >dfn.c
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p' dfn1.out >dfn2.out
$(SED) -e 's| *@@@ *||' -e 's| *$$||' dfn2.out >dfn3.out
mv dfn3.out $@
test: check

12
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.5.0beta14 - March 12, 2010
* libpng version 1.5.0beta14 - March 13, 2010
* Copyright (c) 1998-2010 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.)
@ -11,7 +11,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.5.0beta14 - March 12, 2010: Glenn
* libpng versions 0.97, January 1998, through 1.5.0beta14 - March 13, 2010: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -170,7 +170,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta14, March 12, 2010, are
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta14, March 13, 2010, are
* Copyright (c) 2004, 2006-2010 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:
@ -282,7 +282,7 @@
* Y2K compliance in libpng:
* =========================
*
* March 12, 2010
* March 13, 2010
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@ -346,7 +346,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.0beta14"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.0beta14 - March 12, 2010\n"
" libpng version 1.5.0beta14 - March 13, 2010\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@ -1779,7 +1779,7 @@ extern PNG_EXPORT(void,png_set_sCAL_s,(png_structp png_ptr,
*/
extern PNG_EXPORT(void, png_set_keep_unknown_chunks,(png_structp png_ptr,
int keep, png_bytep chunk_list, int num_chunks),,172);
PNG_EXPORT(int,png_handle_as_unknown,(png_structp png_ptr,
extern PNG_EXPORT(int,png_handle_as_unknown,(png_structp png_ptr,
png_bytep chunk_name),,173);
#endif
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.0beta14 - March 12, 2010
* libpng version 1.5.0beta14 - March 13, 2010
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -1258,23 +1258,22 @@ typedef char FAR * FAR * FAR * png_charppp;
#endif
#ifndef PNG_EXPORT
# ifdef PNG_BUILDSYMS
# ifdef PNG_EXPORT_OLD
# define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_FUNCTION_EXPORT name END
type PNG_IMPEXP (PNGAPI name) PNGARG(args) attributes
# else
# ifdef PNG_EXPORT_OLD
# define PNG_EXPORT(type, name, args, attributes, ordinal)\
type PNG_IMPEXP (PNGAPI name) PNGARG(args) attributes
# else
# define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_IMPEXP type (PNGAPI name) PNGARG(args) attributes
# endif
# define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_IMPEXP type (PNGAPI name) PNGARG(args) attributes
# endif
#endif
#ifndef PNG_REMOVED
# define PNG_REMOVED(name, ordinal)
#endif
#ifndef PNG_CALLBACK
# define PNG_CALLBACK(type, name, args, attributes)\
type (PNGCBAPI name) PNGARG(args) attributes
type (PNGCBAPI name) PNGARG(args) attributes
#endif
#ifndef PNGCAPI
@ -1324,21 +1323,23 @@ typedef char FAR * FAR * FAR * png_charppp;
* accessed from within the library, therefore should be empty during
* a library build.
*/
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __attribute__((__deprecated__))
# endif
# ifndef PNG_DEPSTRUCT
# define PNG_DEPSTRUCT __attribute__((__deprecated__))
# endif
# ifndef PNG_PRIVATE
# if 0 /* Doesn't work so we use deprecated instead*/
# define PNG_PRIVATE \
__attribute__((warning("This function is not exported by libpng.")))
# else
# define PNG_PRIVATE \
__attribute__((__deprecated__))
# ifndef PNGLIB_BUILD
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __attribute__((__deprecated__))
# endif
# endif /* PNG_PRIVATE */
# ifndef PNG_DEPSTRUCT
# define PNG_DEPSTRUCT __attribute__((__deprecated__))
# endif
# ifndef PNG_PRIVATE
# if 0 /* Doesn't work so we use deprecated instead*/
# define PNG_PRIVATE \
__attribute__((warning("This function is not exported by libpng.")))
# else
# define PNG_PRIVATE \
__attribute__((__deprecated__))
# endif
# endif /* PNG_PRIVATE */
# endif /* PNGLIB_BUILD */
# endif /* __GNUC__ */
#endif /* PNG_PEDANTIC_WARNINGS */

View File

@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
* libpng version 1.5.0beta14 - March 12, 2010
* libpng version 1.5.0beta14 - March 13, 2010
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -24,7 +24,6 @@
#ifndef PNGPRIV_H
#define PNGPRIV_H
#define PNG_NO_PEDANTIC_WARNINGS
#define PNGLIB_BUILD
#include "png.h"
#include "pnginfo.h"

32
scripts/def.dfn Normal file
View File

@ -0,0 +1,32 @@
/* def.dfn - define format of libpng.def
*
* Last changed in libpng 1.5.0 [March 12, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_DEFN_MAGIC- name @ordinal-PNG_DEFN_END
#define PNG_REMOVED(name, ordinal)\
PNG_DEFN_MAGIC-; name @ordinal-PNG_DEFN_END
PNG_DEFN_MAGIC-;---------------------------------------------------------------PNG_DEFN_END
PNG_DEFN_MAGIC-; LIBPNG module definition file for Windows, WindowsCE and OS/2-PNG_DEFN_END
PNG_DEFN_MAGIC-; On OS/2 uncomment lines preceded by ;0S2-PNG_DEFN_END
PNG_DEFN_MAGIC-;---------------------------------------------------------------PNG_DEFN_END
PNG_DEFN_MAGIC--PNG_DEFN_END
PNG_DEFN_MAGIC-; If you give the library an explicit name one or other files-PNG_DEFN_END
PNG_DEFN_MAGIC-; may need modifying to support the new name on one or more-PNG_DEFN_END
PNG_DEFN_MAGIC-; systems.-PNG_DEFN_END
PNG_DEFN_MAGIC-LIBRARY-PNG_DEFN_END
PNG_DEFN_MAGIC-;OS2 DESCRIPTION "PNG image compression library"-PNG_DEFN_END
PNG_DEFN_MAGIC-;OS2 CODE PRELOAD MOVEABLE DISCARDABLE-PNG_DEFN_END
PNG_DEFN_MAGIC--PNG_DEFN_END
PNG_DEFN_MAGIC-EXPORTS-PNG_DEFN_END
PNG_DEFN_MAGIC-;Version PNGLIB_VERSION-PNG_DEFN_END
#include "../png.h"

15
scripts/sym.dfn Normal file
View File

@ -0,0 +1,15 @@
/* sym.dfn - define format of libpng.sym
*
* Last changed in libpng 1.5.0 [March 12, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_DEFN_MAGIC-SYMBOL_PREFIX @@@ name-PNG_DEFN_END
#include "../png.h"

26
scripts/vers.dfn Normal file
View File

@ -0,0 +1,26 @@
/* vers.dfn - define format of libpng.vers
*
* Last changed in libpng 1.5.0 [March 12, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#define HEADER PNG_DEFN_MAGIC-PNGLIB_LIBNAME {global:-PNG_DEFN_END
/* NOTE: @@@ is interpreted by the calling script as a signal to
* join the two things on either side, so we can do symbol
* substitution within the name, regular C ## joins the pp-tokens,
* not their final values.
*/
#define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_DEFN_MAGIC- SYMBOL_PREFIX @@@ name;-PNG_DEFN_END
#define TRAILER PNG_DEFN_MAGIC-local: *; };-PNG_DEFN_END
HEADER
#include "../png.h"
TRAILER