PR libstdc++/88740 Print assertion messages to stderr
authorJonathan Wakely <jwakely@redhat.com>
Tue, 22 Jan 2019 16:08:18 +0000 (16:08 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 22 Jan 2019 16:08:18 +0000 (16:08 +0000)
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
libstdc++-v3/testsuite/util/testsuite_hooks.h

index 483f1956e49da750e341e4de3898327196bffce0..4fd9fee932ff0f582c3f7b209f367ac00de4c97b 100644 (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
index 3999a5d6ee120e86692158b66f378869e8ba61c6..51c431bf9c00de5af7d286cfd280ac83fc722f6b 100644 (file)
 #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)