From 0a9f26e219d2c63c50ed189d4bfef85679316422 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 21 Jul 2012 11:16:17 -0500 Subject: [PATCH] [libpng16] Do not use __restrict when GNUC is <= 3.1 --- ANNOUNCE | 5 +++-- CHANGES | 4 +++- pngconf.h | 40 ++++++++++++++++++++++------------------ 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 91bad57f2..e5c9a224e 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.0beta27 - July 14, 2012 +Libpng 1.6.0beta27 - July 21, 2012 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. @@ -399,7 +399,8 @@ Version 1.6.0beta26 [July 10, 2012] Moved scripts/chkfmt to contrib/tools. Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386. -Version 1.6.0beta27 [July 14, 2012] +Version 1.6.0beta27 [July 21, 2012] + Do not use __restrict when GNUC is <= 3.1 Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index b5c569b12..456d22d44 100644 --- a/CHANGES +++ b/CHANGES @@ -4150,7 +4150,9 @@ Version 1.6.0beta26 [July 10, 2012] Moved scripts/chkfmt to contrib/tools. Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386. -Version 1.6.0beta27 [July 14, 2012] +Version 1.6.0beta27 [July 21, 2012] + Do not compile PNG_DEPRECATED, PNG_ALLOC and PNG_PRIVATE when __GNUC__ < 3. + Do not use __restrict when GNUC is <= 3.1 Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngconf.h b/pngconf.h index 694f089b6..46e997aa3 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.0beta27 - July 14, 2012 + * libpng version 1.6.0beta27 - July 21, 2012 * * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -366,24 +366,28 @@ # ifndef PNG_NORETURN # define PNG_NORETURN __attribute__((__noreturn__)) # endif -# ifndef PNG_ALLOCATED -# define PNG_ALLOCATED __attribute__((__malloc__)) -# endif -# ifndef PNG_DEPRECATED -# define PNG_DEPRECATED __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__)) +# if __GNUC__ >= 3 +# ifndef PNG_ALLOCATED +# define PNG_ALLOCATED __attribute__((__malloc__)) # endif -# endif -# ifndef PNG_RESTRICT -# define PNG_RESTRICT __restrict -# endif +# ifndef PNG_DEPRECATED +# define PNG_DEPRECATED __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 +# if ((__GNUC__ != 3) || (__GNUC_MINOR__ >= 1)) +# ifndef PNG_RESTRICT +# define PNG_RESTRICT __restrict +# endif +# endif /* __GNUC__ == 3.0 */ +# endif /* __GNUC__ >= 3 */ # elif defined(_MSC_VER) && (_MSC_VER >= 1300) # ifndef PNG_USE_RESULT