From bda94b100541e0c33e215330597a05ca32ebee1a Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 13 Jan 2014 21:16:17 -0600 Subject: [PATCH] [libpng16] Added clang attribute support (Cosmin). --- ANNOUNCE | 7 ++++--- CHANGES | 5 +++-- pngconf.h | 37 +++++++++++++++++++++++++++++++------ 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 0e12e63a9..b3a2a88bd 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.9beta04 - January 12, 2014 +Libpng 1.6.9beta04 - January 14, 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. @@ -63,8 +63,9 @@ Version 1.6.9beta02 [January 1, 2014] Version 1.6.9beta03 [January 10, 2014] Removed potentially misleading warning from png_check_IHDR(). -Version 1.6.9beta04 [January 12, 2014] - Updated scripts/makefile.* to use CPPFLAGS (Cosmin) +Version 1.6.9beta04 [January 14, 2014] + Updated scripts/makefile.* to use CPPFLAGS (Cosmin). + Added clang attribute support (Cosmin). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index f7ae38de9..8c3a8151c 100644 --- a/CHANGES +++ b/CHANGES @@ -4788,8 +4788,9 @@ Version 1.6.9beta02 [January 1, 2014] Version 1.6.9beta03 [January 10, 2014] Removed potentially misleading warning from png_check_IHDR(). -Version 1.6.9beta04 [January 12, 2014] - Updated scripts/makefile.* to use CPPFLAGS (Cosmin) +Version 1.6.9beta04 [January 14, 2014] + Updated scripts/makefile.* to use CPPFLAGS (Cosmin). + Added clang attribute support (Cosmin). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngconf.h b/pngconf.h index b19cdbdd6..a6cb12852 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.9beta04 - January 12, 2014 + * libpng version 1.6.9beta04 - January 14, 2014 * * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -361,7 +361,31 @@ * version 1.2.41. Disabling these removes the warnings but may also produce * less efficient code. */ -# if defined(__GNUC__) +# if defined(__clang__) + /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */ +# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__) +# define PNG_USE_RESULT __attribute__((__warn_unused_result__)) +# endif +# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__) +# define PNG_NORETURN __attribute__((__noreturn__)) +# endif +# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__) +# define PNG_ALLOCATED __attribute__((__malloc__)) +# endif +# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__) +# define PNG_DEPRECATED __attribute__((__deprecated__)) +# endif +# if !defined(PNG_PRIVATE) +# if __has_extension(attribute_unavailable_with_message) +# define PNG_PRIVATE __attribute__((__unavailable__(\ + "This function is not exported by libpng."))) +# endif +# endif +# ifndef PNG_RESTRICT +# define PNG_RESTRICT __restrict +# endif + +# elif defined(__GNUC__) # ifndef PNG_USE_RESULT # define PNG_USE_RESULT __attribute__((__warn_unused_result__)) # endif @@ -384,12 +408,12 @@ __attribute__((__deprecated__)) # endif # endif -# if ((__GNUC__ != 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1)) +# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1)) # ifndef PNG_RESTRICT # define PNG_RESTRICT __restrict # endif -# endif /* __GNUC__ == 3.0 */ -# endif /* __GNUC__ >= 3 */ +# endif /* __GNUC__ > 3.1 */ +# endif /* __GNUC__ >= 3 */ # elif defined(_MSC_VER) && (_MSC_VER >= 1300) # ifndef PNG_USE_RESULT @@ -419,7 +443,7 @@ # ifndef PNG_RESTRICT # define PNG_RESTRICT __restrict # endif -# endif /* _MSC_VER */ +# endif #endif /* PNG_PEDANTIC_WARNINGS */ #ifndef PNG_DEPRECATED @@ -440,6 +464,7 @@ #ifndef PNG_RESTRICT # define PNG_RESTRICT /* The C99 "restrict" feature */ #endif + #ifndef PNG_FP_EXPORT /* A floating point API. */ # ifdef PNG_FLOATING_POINT_SUPPORTED # define PNG_FP_EXPORT(ordinal, type, name, args)\