From 4c6b09810beee144208acfd097fee6f796961e94 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 22 Jan 2019 16:08:18 +0000 Subject: [PATCH] PR libstdc++/88740 Print assertion messages to stderr PR libstdc++/88740 * testsuite/util/testsuite_hooks.h [stderr] (VERIFY): Use fprintf to write to stderr instead of using printf. From-SVN: r268154 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/testsuite/util/testsuite_hooks.h | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 483f1956e49..4fd9fee932f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2019-01-22 Jonathan Wakely + + PR libstdc++/88740 + * testsuite/util/testsuite_hooks.h [stderr] (VERIFY): Use fprintf to + write to stderr instead of using printf. + 2019-01-21 Jakub Jelinek PR libstdc++/86590 diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h index 3999a5d6ee1..51c431bf9c0 100644 --- a/libstdc++-v3/testsuite/util/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h @@ -46,18 +46,25 @@ #include #include #include +#include #ifdef _GLIBCXX_HAVE_SYS_STAT_H #include #endif +#ifdef stderr +# define _VERIFY_PRINT(S, F, L, P, C) __builtin_fprintf(stderr, S, F, L, P, C) +#else +# define _VERIFY_PRINT(S, F, L, P, C) __builtin_printf(S, F, L, P, C) +#endif + #define VERIFY(fn) \ do \ { \ if (! (fn)) \ { \ - __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", \ - __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \ + _VERIFY_PRINT("%s:%d: %s: Assertion '%s' failed.\n", \ + __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \ __builtin_abort(); \ } \ } while (false) -- 2.30.2