From 551019baf6b4ef58ff22d917a8c89d069a00dbb1 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Thu, 18 Sep 2014 16:41:40 -0500 Subject: [PATCH] [libpng16] Revert recent pngvalid.c changes and define FE_DIVBYZERO, etc., if not already defined. --- ANNOUNCE | 3 +++ CHANGES | 3 +++ contrib/libtests/pngvalid.c | 32 +++++++++++++++++--------------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index a0bee397e..e41c5a043 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -43,6 +43,9 @@ Version 1.6.14beta02 [September 18, 2014] at users.sourceforge.net"). Version 1.6.14beta03 [September 18, 2014] + Define FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in pngvalid.c if not + already defined. Revert floating point exception handling to version + 1.6.14beta01 behavior. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 058ba3abf..231e724c1 100644 --- a/CHANGES +++ b/CHANGES @@ -4996,6 +4996,9 @@ Version 1.6.14beta02 [September 18, 2014] at users.sourceforge.net"). Version 1.6.14beta03 [September 18, 2014] + Define FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in pngvalid.c if not + already defined. Revert floating point exception handling to version + 1.6.14beta01 behavior. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/libtests/pngvalid.c b/contrib/libtests/pngvalid.c index 458c9425a..f4eda7225 100644 --- a/contrib/libtests/pngvalid.c +++ b/contrib/libtests/pngvalid.c @@ -1,7 +1,7 @@ /* pngvalid.c - validate libpng by constructing then reading png files. * - * Last changed in libpng 1.6.10 [March 6, 2014] + * Last changed in libpng 1.6.14 [(PENDING RELEASE)] * Copyright (c) 2014 Glenn Randers-Pehrson * Written by John Cunningham Bowler * @@ -30,6 +30,20 @@ # include #endif +#ifdef HAVE_FEENABLEEXCEPT /* from config.h, if included */ +# include +#endif + +#ifndef FE_DIVBYZERO +#define FE_DIVBYZERO 0 +#endif +#ifndef FE_INVALID +#define FE_INVALID 0 +#endif +#ifndef FE_OVERFLOW +#define FE_OVERFLOW 0 +#endif + /* Define the following to use this test against your installed libpng, rather * than the one being built here: */ @@ -39,13 +53,6 @@ # include "../../png.h" #endif -#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED -# ifdef HAVE_FEENABLEEXCEPT /* from config.h, if included */ -# include -# endif -#endif - - #ifdef PNG_ZLIB_HEADER # include PNG_ZLIB_HEADER #else @@ -9979,11 +9986,9 @@ static void signal_handler(int signum) pos = safecat(msg, sizeof msg, pos, "abort"); break; -#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED case SIGFPE: pos = safecat(msg, sizeof msg, pos, "floating point exception"); break; -#endif case SIGILL: pos = safecat(msg, sizeof msg, pos, "illegal instruction"); @@ -10049,21 +10054,18 @@ int main(int argc, char **argv) /* Add appropriate signal handlers, just the ANSI specified ones: */ signal(SIGABRT, signal_handler); + signal(SIGFPE, signal_handler); signal(SIGILL, signal_handler); signal(SIGINT, signal_handler); signal(SIGSEGV, signal_handler); signal(SIGTERM, signal_handler); -#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED - signal(SIGFPE, signal_handler); - -# ifdef HAVE_FEENABLEEXCEPT +#ifdef HAVE_FEENABLEEXCEPT /* Only required to enable FP exceptions on platforms where they start off * disabled; this is not necessary but if it is not done pngvalid will likely * end up ignoring FP conditions that other platforms fault. */ feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); -# endif #endif modifier_init(&pm);