aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-09 12:35:13 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-09 12:35:13 +0000
commitf81e8dbc74186f34faa5ae2b0fe8bdc3f18114ae (patch)
tree91ee95914c2b9a07817bd6f596fc3df758651147 /include
parent327fd47f362843fc62fbee6169904c416ca13d11 (diff)
downloadbusybox-f81e8dbc74186f34faa5ae2b0fe8bdc3f18114ae.tar.gz
*: make "pragma GCC visibility push(hidden)" less ugly
Diffstat (limited to 'include')
-rw-r--r--include/busybox.h14
-rw-r--r--include/dump.h8
-rw-r--r--include/grp_.h17
-rw-r--r--include/libbb.h15
-rw-r--r--include/platform.h16
-rw-r--r--include/pwd_.h12
-rw-r--r--include/rtc_.h10
-rw-r--r--include/shadow_.h8
-rw-r--r--include/unarchive.h12
-rw-r--r--include/usage.h8
-rw-r--r--include/xatonum.h8
-rw-r--r--include/xregex.h12
12 files changed, 54 insertions, 86 deletions
diff --git a/include/busybox.h b/include/busybox.h
index 314b95126..54c278f87 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -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
diff --git a/include/dump.h b/include/dump.h
index 44f2082b7..925270d9c 100644
--- a/include/dump.h
+++ b/include/dump.h
@@ -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
diff --git a/include/grp_.h b/include/grp_.h
index 3d00b4aa7..deaf9e6a3 100644
--- a/include/grp_.h
+++ b/include/grp_.h
@@ -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
diff --git a/include/libbb.h b/include/libbb.h
index 74ec678d8..babf9c9f7 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -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
-#endif
-
+POP_SAVED_FUNCTION_VISIBILITY
-#endif /* __LIBBUSYBOX_H__ */
+#endif
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
diff --git a/include/pwd_.h b/include/pwd_.h
index a0cf7c9f7..f52445ceb 100644
--- a/include/pwd_.h
+++ b/include/pwd_.h
@@ -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 */
diff --git a/include/rtc_.h b/include/rtc_.h
index ae17ee7d4..74bb695a0 100644
--- a/include/rtc_.h
+++ b/include/rtc_.h
@@ -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
diff --git a/include/shadow_.h b/include/shadow_.h
index 60f3e6b5f..02d3bf9a5 100644
--- a/include/shadow_.h
+++ b/include/shadow_.h
@@ -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 */
diff --git a/include/unarchive.h b/include/unarchive.h
index 9077130a5..beb962c8f 100644
--- a/include/unarchive.h
+++ b/include/unarchive.h
@@ -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
diff --git a/include/usage.h b/include/usage.h
index af54b86a7..cbbd7516a 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -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
diff --git a/include/xatonum.h b/include/xatonum.h
index 86a3472d9..ee816efb4 100644
--- a/include/xatonum.h
+++ b/include/xatonum.h
@@ -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
diff --git a/include/xregex.h b/include/xregex.h
index 90cf124ee..61658ed85 100644
--- a/include/xregex.h
+++ b/include/xregex.h
@@ -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