*: make "pragma GCC visibility push(hidden)" less ugly

This commit is contained in:
Denis Vlasenko
2009-04-09 12:35:13 +00:00
parent 327fd47f36
commit f81e8dbc74
43 changed files with 158 additions and 266 deletions

View File

@@ -4,14 +4,12 @@
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef _BB_INTERNAL_H_
#define _BB_INTERNAL_H_ 1
#ifndef BUSYBOX_H
#define BUSYBOX_H 1
#include "libbb.h"
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* order matters: used as index into "install_dir[]" in appletlib.c */
typedef enum bb_install_loc_t {
@@ -71,8 +69,6 @@ int lbb_main(char **argv);
#endif
#endif
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif /* _BB_INTERNAL_H_ */
#endif

View File

@@ -1,8 +1,6 @@
/* vi: set sw=4 ts=4: */
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
#define F_IGNORE 0x01 /* %_A */
#define F_SETREP 0x02 /* rep count set, not default */
@@ -55,6 +53,4 @@ dumper_t* alloc_dumper(void) FAST_FUNC;
extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC;
extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC;
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY

View File

@@ -15,18 +15,15 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
02111-1307 USA.
*/
/*
* POSIX Standard: 9.2.1 Group Database Access <grp.h>
*/
#ifndef BB_GRP_H
#define BB_GRP_H 1
#ifndef BB_GRP_H
#define BB_GRP_H 1
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* This file is #included after #include <grp.h>
* We will use libc-defined structures, but will #define function names
@@ -115,8 +112,6 @@ extern int getgrouplist(const char *__user, gid_t __group,
of which USER is a member. Also include GROUP. */
extern int initgroups(const char *__user, gid_t __group);
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif

View File

@@ -7,8 +7,8 @@
*
* Licensed under the GPL version 2, see the file LICENSE in this tarball.
*/
#ifndef __LIBBUSYBOX_H__
#define __LIBBUSYBOX_H__ 1
#ifndef LIBBB_H
#define LIBBB_H 1
#include "platform.h"
@@ -110,9 +110,7 @@ int sysinfo(struct sysinfo* info);
/* Make all declarations hidden (-fvisibility flag only affects definitions) */
/* (don't include system headers after this until corresponding pop!) */
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
#if ENABLE_USE_BB_PWD_GRP
@@ -1532,9 +1530,6 @@ extern const char bb_default_login_shell[];
#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
POP_SAVED_FUNCTION_VISIBILITY
#endif
#endif /* __LIBBUSYBOX_H__ */

View File

@@ -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

View File

@@ -21,12 +21,10 @@
* POSIX Standard: 9.2.2 User Database Access <pwd.h>
*/
#ifndef BB_PWD_H
#define BB_PWD_H 1
#ifndef BB_PWD_H
#define BB_PWD_H 1
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* This file is #included after #include <pwd.h>
* We will use libc-defined structures, but will #define function names
@@ -107,8 +105,6 @@ extern int fgetpwent_r(FILE *__restrict __stream,
will expect, but this need not be the format of the password file. */
/* UNUSED extern int getpw(uid_t __uid, char *__buffer); */
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif /* pwd.h */

View File

@@ -5,13 +5,11 @@
*/
#ifndef BB_RTC_H
#define BB_RTC_H
#define BB_RTC_H 1
#include "libbb.h"
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
extern int rtc_adjtime_is_utc(void) FAST_FUNC;
extern int rtc_xopen(const char **default_rtc, int flags) FAST_FUNC;
@@ -71,8 +69,6 @@ struct linux_rtc_wkalrm {
#define RTC_AF 0x20
#define RTC_UF 0x10
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif

View File

@@ -22,9 +22,7 @@
#ifndef BB_SHADOW_H
#define BB_SHADOW_H 1
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* This file is #included after #include <shadow.h>
* We will use libc-defined structures, but will #define function names
@@ -97,8 +95,6 @@ extern int lckpwdf(void);
/* Unlock password file */
extern int ulckpwdf(void);
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif /* shadow.h */

View File

@@ -1,10 +1,8 @@
/* vi: set sw=4 ts=4: */
#ifndef __UNARCHIVE_H__
#define __UNARCHIVE_H__
#ifndef UNARCHIVE_H
#define UNARCHIVE_H 1
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
#define ARCHIVE_PRESERVE_DATE 1
#define ARCHIVE_CREATE_LEADING_DIRS 2
@@ -150,8 +148,6 @@ void open_transformer(int src_fd, const char *transform_prog) FAST_FUNC;
#define open_transformer(fd, transformer, transform_prog) open_transformer(fd, transform_prog)
#endif
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif

View File

@@ -9,9 +9,8 @@
* or
* |<5 spaces>"\ntext with tabs"....
*/
#ifndef __BB_USAGE_H__
#define __BB_USAGE_H__
#ifndef BB_USAGE_H
#define BB_USAGE_H 1
#define NOUSAGE_STR "\b"
@@ -4921,4 +4920,5 @@ USE_FEATURE_TUNCTL_UG( \
"\nWith no -q, runs continuously monitoring for ARP conflicts," \
"\nexits only on I/O errors (link down etc)" \
#endif /* __BB_USAGE_H__ */
#endif

View File

@@ -7,9 +7,7 @@
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* Provides extern declarations of functions */
#define DECLARE_STR_CONV(type, T, UT) \
@@ -171,6 +169,4 @@ uint32_t bb_strtou32(const char *arg, char **endp, int base)
double bb_strtod(const char *arg, char **endp) FAST_FUNC;
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY

View File

@@ -8,20 +8,16 @@
*
* Licensed under GPLv2 or later, see file License in this tarball for details.
*/
#ifndef __BB_REGEX__
#define __BB_REGEX__
#ifndef BB_REGEX_H
#define BB_REGEX_H 1
#include <regex.h>
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
char* regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags) FAST_FUNC;
void xregcomp(regex_t *preg, const char *regex, int cflags) FAST_FUNC;
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif