From 02a889566d5bece72c2666536bacbb8f4f099be6 Mon Sep 17 00:00:00 2001 From: Robert Quattlebaum Date: Mon, 20 Jun 2016 17:43:48 -0700 Subject: [PATCH] spinel: Fix for building on platforms without `fprintf()` (#188) Some platforms do not implement `fprintf()`. This change allows Spinel to build properly on platforms that only have `printf()`. To allow Spinel to build on those platforms, build Spinel with the following command line argument: -DSPINEL_PLATFORM_DOESNT_IMPLEMENT_FPRINTF=1 --- src/ncp/spinel.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ncp/spinel.c b/src/ncp/spinel.c index b00732175..62369abc6 100644 --- a/src/ncp/spinel.c +++ b/src/ncp/spinel.c @@ -65,11 +65,13 @@ static int spinel_errno_workaround_; #endif // SPINEL_PLATFORM_DOESNT_IMPLEMENT_ERRNO_VAR #ifndef assert_printf +#if SPINEL_PLATFORM_DOESNT_IMPLEMENT_FPRINTF #define assert_printf(fmt, ...) \ -fprintf(stderr, \ - __FILE__ ":%d: " fmt "\n", \ - __LINE__, \ - __VA_ARGS__) + printf(__FILE__ ":%d: " fmt "\n", __LINE__, __VA_ARGS__) +#else // if SPINEL_PLATFORM_DOESNT_IMPLEMENT_FPRINTF +#define assert_printf(fmt, ...) \ + fprintf(stderr, __FILE__ ":%d: " fmt "\n", __LINE__, __VA_ARGS__) +#endif // else SPINEL_PLATFORM_DOESNT_IMPLEMENT_FPRINTF #endif #ifndef require_action