From f81e8dbc74186f34faa5ae2b0fe8bdc3f18114ae Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 9 Apr 2009 12:35:13 +0000 Subject: *: make "pragma GCC visibility push(hidden)" less ugly --- include/platform.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'include/platform.h') diff --git a/include/platform.h b/include/platform.h index 13dfcbd32..47fd5f63d 100644 --- a/include/platform.h +++ b/include/platform.h @@ -4,8 +4,8 @@ Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ -#ifndef __PLATFORM_H -#define __PLATFORM_H 1 +#ifndef BB_PLATFORM_H +#define BB_PLATFORM_H 1 /* Convenience macros to test the version of gcc. */ #undef __GNUC_PREREQ @@ -110,6 +110,16 @@ # define FAST_FUNC #endif +/* Make all declarations hidden (-fvisibility flag only affects definitions) */ +/* (don't include system headers after this until corresponding pop!) */ +#if __GNUC_PREREQ(4,1) +# define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") +# define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") +#else +# define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN +# define POP_SAVED_FUNCTION_VISIBILITY +#endif + /* ---- Endian Detection ------------------------------------ */ #if (defined __digital__ && defined __unix__) @@ -371,4 +381,4 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c) #endif #endif -#endif /* platform.h */ +#endif -- cgit v1.2.3