[Zlib-devel] zlib 1.2.4.4 -- a 1.2.5 release candidate

Cosmin Truta cosmin at cs.toronto.edu
Sun Apr 18 11:36:13 EDT 2010


2010/4/18 Török Edwin:
> Also zconf.h breaks on MSVC++ 2008, because nothing defines NO_VIZ.
>
> So probably a patch like this would be needed:
> [...]

That patch is only a quick fix for VC++ but leaves all the other
compilers out in the cold. Compilation still fails with Watcom,
Borland, etc.

The original code is incorrect because it places a non-standard gcc-4
extension in plain sight. I am providing the fix below.

As a general rule, if a non-portable code snippet is meant to be run
on compiler foo version xyz, the correct way to go is to guard that
snippet by
#if defined(__FOO__) && __FOO_VERSION__ >= XYZ

Best regards,
Cosmin


--- zconf.h~    Sun Apr 18 03:51:32 2010
+++ zconf.h     Sun Apr 18 11:28:00 2010
@@ -316,7 +316,9 @@
 #endif

 #ifndef NO_VIZ
-#  define ZEXTERN __attribute__((visibility ("default"))) extern
+#  if defined(__GNUC__) && __GNUC__ >= 4
+#    define ZEXTERN __attribute__((visibility ("default"))) extern
+#  endif
 #endif

 #ifndef ZEXTERN




More information about the Zlib-devel mailing list