From 8be3678a2331250b0559d07526e66b73d1794d8c Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 12 May 2019 22:39:59 +0200 Subject: [PATCH] lib/printf: rename & private __find_arguments These are internal to printf(), and symbols starting with __ are reserved for the compiler/libc. Signed-off-by: David Lamparter --- lib/compiler.h | 10 ++++++++++ lib/module.h | 10 ---------- lib/printf/printf-pos.c | 4 ++-- lib/printf/printflocal.h | 6 ++++-- lib/printf/vfprintf.c | 4 ++-- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/compiler.h b/lib/compiler.h index c2e57db7f8..7509428220 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -50,6 +50,16 @@ extern "C" { #endif #endif +#if !defined(__GNUC__) +#error module code needs GCC visibility extensions +#elif __GNUC__ < 4 +#error module code needs GCC visibility extensions +#else +# define DSO_PUBLIC __attribute__ ((visibility ("default"))) +# define DSO_SELF __attribute__ ((visibility ("protected"))) +# define DSO_LOCAL __attribute__ ((visibility ("hidden"))) +#endif + #ifdef __sun /* Solaris doesn't do constructor priorities due to linker restrictions */ #undef _CONSTRUCTOR diff --git a/lib/module.h b/lib/module.h index c5f96db85b..79cf52d75a 100644 --- a/lib/module.h +++ b/lib/module.h @@ -24,16 +24,6 @@ extern "C" { #endif -#if !defined(__GNUC__) -#error module code needs GCC visibility extensions -#elif __GNUC__ < 4 -#error module code needs GCC visibility extensions -#else -# define DSO_PUBLIC __attribute__ ((visibility ("default"))) -# define DSO_SELF __attribute__ ((visibility ("protected"))) -# define DSO_LOCAL __attribute__ ((visibility ("hidden"))) -#endif - struct frrmod_runtime; struct frrmod_info { diff --git a/lib/printf/printf-pos.c b/lib/printf/printf-pos.c index c66f4d1a06..a461a2be9a 100644 --- a/lib/printf/printf-pos.c +++ b/lib/printf/printf-pos.c @@ -250,7 +250,7 @@ addwaster(struct typetable *types, wchar_t **fmtp) * Returns 0 on success. On failure, returns nonzero and sets errno. */ int -__find_arguments (const char *fmt0, va_list ap, union arg **argtable) +_frr_find_arguments (const char *fmt0, va_list ap, union arg **argtable) { char *fmt; /* format string */ int ch; /* character from fmt */ @@ -442,7 +442,7 @@ error: #ifdef WCHAR_SUPPORT /* wchar version of __find_arguments. */ int -__find_warguments (const wchar_t *fmt0, va_list ap, union arg **argtable) +_frr_find_warguments (const wchar_t *fmt0, va_list ap, union arg **argtable) { wchar_t *fmt; /* format string */ wchar_t ch; /* character from fmt */ diff --git a/lib/printf/printflocal.h b/lib/printf/printflocal.h index 5860c5c04e..a2de161130 100644 --- a/lib/printf/printflocal.h +++ b/lib/printf/printflocal.h @@ -34,6 +34,8 @@ * $FreeBSD$ */ +#include "compiler.h" + /* * Flags used during conversion. */ @@ -92,7 +94,7 @@ union arg { }; /* Handle positional parameters. */ -int __find_arguments(const char *, va_list, union arg **); +int _frr_find_arguments(const char *, va_list, union arg **) DSO_LOCAL; #ifdef WCHAR_SUPPORT -int __find_warguments(const wchar_t *, va_list, union arg **); +int _frr_find_warguments(const wchar_t *, va_list, union arg **) DSO_LOCAL; #endif diff --git a/lib/printf/vfprintf.c b/lib/printf/vfprintf.c index 7374a03e73..66cedcb698 100644 --- a/lib/printf/vfprintf.c +++ b/lib/printf/vfprintf.c @@ -253,7 +253,7 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap) int hold = nextarg; \ if (argtable == NULL) { \ argtable = statargtable; \ - if (__find_arguments (fmt0, orgap, &argtable)) { \ + if (_frr_find_arguments (fmt0, orgap, &argtable)) { \ ret = EOF; \ goto error; \ } \ @@ -369,7 +369,7 @@ reswitch: switch (ch) { nextarg = n; if (argtable == NULL) { argtable = statargtable; - if (__find_arguments (fmt0, orgap, + if (_frr_find_arguments (fmt0, orgap, &argtable)) { ret = EOF; goto error;