From 2e185ba578cf996a9e6cd7b6a0321a2448064e52 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Tue, 24 Mar 2020 16:29:04 +0100 Subject: [PATCH] BMP/PC: Allow to compile with mingw64 (#615) __USE_MINGW_ANSI_STDIO 1 must be set befor any windows specific included. --- src/include/general.h | 4 +++- src/platforms/pc/cl_utils.c | 2 +- src/platforms/pc/gdb_if.c | 1 + src/target/samx5x.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/include/general.h b/src/include/general.h index b29d039..f8cb927 100644 --- a/src/include/general.h +++ b/src/include/general.h @@ -22,7 +22,9 @@ #define __GENERAL_H #define _GNU_SOURCE -#define __USE_MINGW_ANSI_STDIO 1 +#if !defined(__USE_MINGW_ANSI_STDIO) +# define __USE_MINGW_ANSI_STDIO 1 +#endif #include #include #include diff --git a/src/platforms/pc/cl_utils.c b/src/platforms/pc/cl_utils.c index 40a8f9a..e5b55d1 100644 --- a/src/platforms/pc/cl_utils.c +++ b/src/platforms/pc/cl_utils.c @@ -22,13 +22,13 @@ * binary file from the command line. */ +#include "general.h" #include #include #include #include #include -#include "general.h" #include "target.h" #include "target_internal.h" diff --git a/src/platforms/pc/gdb_if.c b/src/platforms/pc/gdb_if.c index e00cf3a..3199465 100644 --- a/src/platforms/pc/gdb_if.c +++ b/src/platforms/pc/gdb_if.c @@ -24,6 +24,7 @@ */ #if defined(_WIN32) || defined(__CYGWIN__) +# define __USE_MINGW_ANSI_STDIO 1 # include # include # include diff --git a/src/target/samx5x.c b/src/target/samx5x.c index 66f1fda..e23912c 100644 --- a/src/target/samx5x.c +++ b/src/target/samx5x.c @@ -31,9 +31,9 @@ * particularly Sections 12. DSU and 25. NVMCTRL */ +#include "general.h" #include -#include "general.h" #include "target.h" #include "target_internal.h" #include "cortexm.h"