From: Hans Kristian Rosbach Date: Thu, 28 Apr 2016 09:04:15 +0000 (+0200) Subject: Add support for internal attribute, the advantage of this over hidden X-Git-Tag: 1.9.9-b1~784 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03d7ad3fd028cefbb8d9d1b94c1b0a9433e503e3;p=thirdparty%2Fzlib-ng.git Add support for internal attribute, the advantage of this over hidden is for example that the compiler can safely assume that pointers to functions declared internal can never be passed externally. This allows the compiler to consider optimizations otherwise impossible. --- diff --git a/configure b/configure index d437c2095..1c41b4a1a 100755 --- a/configure +++ b/configure @@ -582,7 +582,7 @@ else leave 1 fi -# see if we can hide zlib internal symbols that are linked between separate source files +# see if we can hide zlib internal symbols that are linked between separate source files using hidden if test "$gcc" -eq 1; then echo >> configure.log cat > $test.c <> configure.log - echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log + echo "Checking for attribute(visibility(hidden)) support... Yes." | tee -a configure.log else echo >> configure.log - echo "Checking for attribute(visibility) support... No." | tee -a configure.log + echo "Checking for attribute(visibility(hidden)) support... No." | tee -a configure.log + fi +fi + +# see if we can hide zlib internal symbols that are linked between separate source files using internal +if test "$gcc" -eq 1; then + echo >> configure.log + cat > $test.c <> configure.log + echo "Checking for attribute(visibility(internal)) support... Yes." | tee -a configure.log + else + echo >> configure.log + echo "Checking for attribute(visibility(internal)) support... No." | tee -a configure.log fi fi diff --git a/zutil.h b/zutil.h index c56ca71f1..b6e858c9c 100644 --- a/zutil.h +++ b/zutil.h @@ -12,7 +12,9 @@ /* @(#) $Id$ */ -#ifdef HAVE_HIDDEN +#if defined(HAVE_INTERNAL) +# define ZLIB_INTERNAL __attribute__((visibility ("internal"))) +#elif defined(HAVE_HIDDEN) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL