]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR libstdc++/88740 Print assertion messages to stderr
authorJonathan Wakely <jwakely@redhat.com>
Thu, 23 May 2019 15:34:37 +0000 (16:34 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 23 May 2019 15:34:37 +0000 (16:34 +0100)
Backport from mainline
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.

From-SVN: r271569

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/util/testsuite_hooks.h

index 0dcf2f63b3540c8de3e2258ef267e0e593a8770e..6b9a547561686ae27d95204bcd7ade7f5f04ba95 100644 (file)
@@ -1,3 +1,12 @@
+2019-05-23  Jonathan Wakely  <jwakely@redhat.com>
+
+       Backport from mainline
+       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-05-23  Jonathan Wakely  <jwakely@redhat.com>
 
        Backport from mainline
index c3b902b53fda8dbf6565617e1e1aebdfab309729..d4c029e0b6be78334add12ee010c75741cc4f266 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)