Cygwin: fix declaration of __small_{v}sprintf

Both functions are declared as extern "C" functions in
sys/smallprint.h, but as C++ funcs in winsup.h and in the
source itself.

Add extern "C to definitions, remove declarations in winsup.h
and include sys/smallprint.h instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2020-05-25 13:10:41 +02:00
parent 8d7a5b39d2
commit 5489240c1b
2 changed files with 7 additions and 4 deletions

View File

@ -130,7 +130,7 @@ __rn (char *dst, int base, int dosign, long long val, int len, int pad, unsigned
return dst; return dst;
} }
int extern "C" int
__small_vsprintf (char *dst, const char *fmt, va_list ap) __small_vsprintf (char *dst, const char *fmt, va_list ap)
{ {
tmpbuf tmp; tmpbuf tmp;
@ -373,7 +373,7 @@ gen_decimalLL:
return dst - orig; return dst - orig;
} }
int extern "C" int
__small_sprintf (char *dst, const char *fmt, ...) __small_sprintf (char *dst, const char *fmt, ...)
{ {
int r; int r;

View File

@ -14,7 +14,11 @@ details. */
#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy"))) #define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy")))
#define NO_COPY_INIT __attribute__((section(".data_cygwin_nocopy"))) #define NO_COPY_INIT __attribute__((section(".data_cygwin_nocopy")))
#ifdef __cplusplus
#define EXPORT_ALIAS(sym,symalias) extern "C" __typeof (sym) symalias __attribute__ ((alias(#sym))); #define EXPORT_ALIAS(sym,symalias) extern "C" __typeof (sym) symalias __attribute__ ((alias(#sym)));
#else
#define EXPORT_ALIAS(sym,symalias) __typeof (sym) symalias __attribute__ ((alias(#sym)));
#endif
#define _WIN32_WINNT 0x0a00 #define _WIN32_WINNT 0x0a00
#define WINVER 0x0a00 #define WINVER 0x0a00
@ -28,6 +32,7 @@ details. */
#include <sys/types.h> #include <sys/types.h>
#include <sys/strace.h> #include <sys/strace.h>
#include <sys/smallprint.h>
/* Declarations for functions used in C and C++ code. */ /* Declarations for functions used in C and C++ code. */
#ifdef __cplusplus #ifdef __cplusplus
@ -223,8 +228,6 @@ void set_ishybrid_and_switch_to_pcon (HANDLE h);
/* Printf type functions */ /* Printf type functions */
extern "C" void vapi_fatal (const char *, va_list ap) __attribute__ ((noreturn)); extern "C" void vapi_fatal (const char *, va_list ap) __attribute__ ((noreturn));
extern "C" void api_fatal (const char *, ...) __attribute__ ((noreturn)); extern "C" void api_fatal (const char *, ...) __attribute__ ((noreturn));
int __small_sprintf (char *dst, const char *fmt, ...);
int __small_vsprintf (char *dst, const char *fmt, va_list ap);
int __small_swprintf (PWCHAR dst, const WCHAR *fmt, ...); int __small_swprintf (PWCHAR dst, const WCHAR *fmt, ...);
int __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap); int __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap);
void multiple_cygwin_problem (const char *, uintptr_t, uintptr_t); void multiple_cygwin_problem (const char *, uintptr_t, uintptr_t);