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
This commit is contained in:
Jonathan Wakely 2019-01-22 16:08:18 +00:00 committed by Jonathan Wakely
parent 494df8753b
commit 4c6b09810b
2 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2019-01-22 Jonathan Wakely <jwakely@redhat.com>
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 <jakub@redhat.com>
PR libstdc++/86590

View File

@ -46,18 +46,25 @@
#include <bits/c++config.h>
#include <bits/functexcept.h>
#include <ctime>
#include <stdio.h>
#ifdef _GLIBCXX_HAVE_SYS_STAT_H
#include <sys/stat.h>
#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)