mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[master] Added macros to detect use of deprecated features.
Added PNG_DEPSTRUCT, PNG_DEPRECATED, PNG_USE_RESULT, PNG_NORETURN, and
PNG_ALLOCATED macros to detect deprecated direct access to the
png_struct or info_struct members and other deprecated usage in
applications (John Bowler).
Added -DPNG_CONFIGURE_LIBPNG to the makefile CFLAGS, to prevent warnings
about direct access to png structs by libpng functions while building
libpng.
Removed three direct references to read_info_ptr members in pngtest.c
that were detected by the new PNG_DEPSTRUCT macro.
Moved the png_debug macro definitions and the png_read_destroy(),
png_write_destroy() and png_far_to_near() prototypes from png.h
to pngpriv.h (John Bowler)
Moved the synopsis lines for png_read_destroy(), png_write_destroy()
png_debug(), png_debug1(), and png_debug2() from libpng.3 to libpngpf.3.
This commit is contained in:
35
pngconf.h
35
pngconf.h
@@ -1286,6 +1286,41 @@ typedef char FAR * FAR * FAR * png_charppp;
|
||||
# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
|
||||
#endif
|
||||
|
||||
/* Support for compiler specific function attributes. These are used
|
||||
* so that where compiler support is available incorrect use of API
|
||||
* functions in png.h will generate compiler warnings.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
# define PNG_DEPRECATED __attribute__((__deprecated__))
|
||||
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||
# define PNG_NORETURN __attribute__((__noreturn__))
|
||||
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||
|
||||
# ifndef PNG_CONFIGURE_LIBPNG
|
||||
/* This specifically protects structure members that should only be
|
||||
* accessed from within the library, therefore should be empty during
|
||||
* a library build.
|
||||
*/
|
||||
# define PNG_DEPSTRUCT __attribute__((__deprecated__))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef PNG_DEPRECATED
|
||||
# define PNG_DEPRECATED /* use of this function is deprecated */
|
||||
#endif
|
||||
#ifndef PNG_USE_RESULT
|
||||
# define PNG_USE_RESULT /* the result of this function must be checked */
|
||||
#endif
|
||||
#ifndef PNG_NORETURN
|
||||
# define PNG_NORETURN /* this function does not return */
|
||||
#endif
|
||||
#ifndef PNG_ALLOCATED
|
||||
# define PNG_ALLOCATED /* the result of the function is new memory */
|
||||
#endif
|
||||
#ifndef PNG_DEPSTRUCT
|
||||
# define PNG_DEPSTRUCT /* access to this struct member is deprecated */
|
||||
#endif
|
||||
|
||||
/* Users may want to use these so they are not private. Any library
|
||||
* functions that are passed far data must be model-independent.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user