From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id B0A1C38708EB; Mon, 25 May 2020 11:33:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0A1C38708EB Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: fix declaration of __small_{v}sprintf X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 8d7a5b39d2fa3fe009dfae3fe90d6d2e9962f98e X-Git-Newrev: 5489240c1bc56c9c4075766addf41af5df276cf0 Message-Id: <20200525113333.B0A1C38708EB@sourceware.org> Date: Mon, 25 May 2020 11:33:33 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2020 11:33:33 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5489240c1bc56c9c4075766addf41af5df276cf0 commit 5489240c1bc56c9c4075766addf41af5df276cf0 Author: Corinna Vinschen Date: Mon May 25 13:10:41 2020 +0200 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 Diff: --- winsup/cygwin/smallprint.cc | 4 ++-- winsup/cygwin/winsup.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc index 3a693b5d1..26d34d9e4 100644 --- a/winsup/cygwin/smallprint.cc +++ b/winsup/cygwin/smallprint.cc @@ -130,7 +130,7 @@ __rn (char *dst, int base, int dosign, long long val, int len, int pad, unsigned return dst; } -int +extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap) { tmpbuf tmp; @@ -373,7 +373,7 @@ gen_decimalLL: return dst - orig; } -int +extern "C" int __small_sprintf (char *dst, const char *fmt, ...) { int r; diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 2916728b6..fff7d18f3 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -14,7 +14,11 @@ details. */ #define NO_COPY __attribute__((nocommon)) __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))); +#else +#define EXPORT_ALIAS(sym,symalias) __typeof (sym) symalias __attribute__ ((alias(#sym))); +#endif #define _WIN32_WINNT 0x0a00 #define WINVER 0x0a00 @@ -28,6 +32,7 @@ details. */ #include #include +#include /* Declarations for functions used in C and C++ code. */ #ifdef __cplusplus @@ -223,8 +228,6 @@ void set_ishybrid_and_switch_to_pcon (HANDLE h); /* Printf type functions */ extern "C" void vapi_fatal (const char *, va_list ap) __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_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap); void multiple_cygwin_problem (const char *, uintptr_t, uintptr_t);