use proper formatting macros when using MinGW provided stdio
add changelog entry Signed-off-by: eugene <eugene.kobyakov@netfoundry.io>
This commit is contained in:
parent
eb3e463380
commit
e42a50da04
2 changed files with 13 additions and 4 deletions
4
ChangeLog.d/fix-mingw-build.txt
Normal file
4
ChangeLog.d/fix-mingw-build.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Changes
|
||||||
|
* fix build failure on MinGW toolchain when __USE_MING_ANSI_STDIO is on.
|
||||||
|
When that flag is on, standard GNU C printf format specifiers should be used.
|
||||||
|
|
|
@ -98,8 +98,13 @@
|
||||||
*/
|
*/
|
||||||
#if defined(__has_attribute)
|
#if defined(__has_attribute)
|
||||||
#if __has_attribute(format)
|
#if __has_attribute(format)
|
||||||
|
#if defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 1
|
||||||
#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) \
|
#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) \
|
||||||
__attribute__((format (printf, string_index, first_to_check)))
|
__attribute__((__format__ (gnu_printf, string_index, first_to_check)))
|
||||||
|
#else /* defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 1 */
|
||||||
|
#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check) \
|
||||||
|
__attribute__((format(printf, string_index, first_to_check)))
|
||||||
|
#endif
|
||||||
#else /* __has_attribute(format) */
|
#else /* __has_attribute(format) */
|
||||||
#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check)
|
#define MBEDTLS_PRINTF_ATTRIBUTE(string_index, first_to_check)
|
||||||
#endif /* __has_attribute(format) */
|
#endif /* __has_attribute(format) */
|
||||||
|
@ -119,14 +124,14 @@
|
||||||
*
|
*
|
||||||
* This module provides debugging functions.
|
* This module provides debugging functions.
|
||||||
*/
|
*/
|
||||||
#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1800)
|
#if (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800)
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#define MBEDTLS_PRINTF_SIZET PRIuPTR
|
#define MBEDTLS_PRINTF_SIZET PRIuPTR
|
||||||
#define MBEDTLS_PRINTF_LONGLONG "I64d"
|
#define MBEDTLS_PRINTF_LONGLONG "I64d"
|
||||||
#else /* defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1800) */
|
#else /* (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800) */
|
||||||
#define MBEDTLS_PRINTF_SIZET "zu"
|
#define MBEDTLS_PRINTF_SIZET "zu"
|
||||||
#define MBEDTLS_PRINTF_LONGLONG "lld"
|
#define MBEDTLS_PRINTF_LONGLONG "lld"
|
||||||
#endif /* defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1800) */
|
#endif /* (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800) */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
Loading…
Reference in a new issue