summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-08-31 12:20:26 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-08-31 12:20:26 (GMT)
commite546ecd3afd6660432178f2e9f692f8fcd16a712 (patch)
tree5144742d90d7d6ab9fb227fcfec5a4e362a0b028 /src
parent4f933036a0ecbc6e6174b312ec2fd6078cea5b70 (diff)
parenta36c81774cb6ac45c211c85f6f2e797688b4946b (diff)
downloadQt-e546ecd3afd6660432178f2e9f692f8fcd16a712.zip
Qt-e546ecd3afd6660432178f2e9f692f8fcd16a712.tar.gz
Qt-e546ecd3afd6660432178f2e9f692f8fcd16a712.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Fix build with Clang for libpng versions 1.4.0 to 1.5.2
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qpnghandler.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index f7d07a5..1714442 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -58,6 +58,29 @@
#include <pngconf.h>
#endif
+#if PNG_LIBPNG_VER >= 10400 && PNG_LIBPNG_VER <= 10502 \
+ && defined(PNG_PEDANTIC_WARNINGS_SUPPORTED)
+/*
+ Versions 1.4.0 to 1.5.2 of libpng declare png_longjmp_ptr to
+ have a noreturn attribute if PNG_PEDANTIC_WARNINGS_SUPPORTED
+ is enabled, but most declarations of longjmp in the wild do
+ not add this attribute. This causes problems when the png_jmpbuf
+ macro expands to calling png_set_longjmp_fn with a mismatched
+ longjmp, as compilers such as Clang will treat this as an error.
+
+ To work around this we override the png_jmpbuf macro to cast
+ longjmp to a png_longjmp_ptr.
+*/
+# undef png_jmpbuf
+# ifdef PNG_SETJMP_SUPPORTED
+# define png_jmpbuf(png_ptr) \
+ (*png_set_longjmp_fn((png_ptr), (png_longjmp_ptr)longjmp, sizeof(jmp_buf)))
+# else
+# define png_jmpbuf(png_ptr) \
+ (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
+# endif
+#endif
+
#ifdef Q_OS_WINCE
#define CALLBACK_CALL_TYPE __cdecl
#else