aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorAndrew Ng <andrew.ng@sony.com>2023-07-14 11:38:18 +0300
committerMartin Storsjö <martin@martin.st>2023-07-28 23:51:27 +0300
commitcd1b8be8de91bc1c43bac3eea7ebf3b5643b031c (patch)
tree19e35aadceaf928ee545297dca3c5c4b947afe98 /libcxx
parente346fd8a60d4969b29bdd1740a89b1ea43635331 (diff)
downloadllvm-cd1b8be8de91bc1c43bac3eea7ebf3b5643b031c.zip
llvm-cd1b8be8de91bc1c43bac3eea7ebf3b5643b031c.tar.gz
llvm-cd1b8be8de91bc1c43bac3eea7ebf3b5643b031c.tar.bz2
[libcxx] [test] Make set_windows_crt_report_mode.h more explicit
This header is included when building with a debug CRT in MSVC/Clang-cl environments. By default, failed asserts with the debug CRT pops up a blocking dialog box alerting the user about the failed assert. When running more than one test in an automated fashion, this isn't ideal. This header tries to run initializers to set the behaviour of the failed asserts to print a message to the console, just like the default is in release mode. This is previously done by setting the reporting mode to _CRTDBG_MODE_DEBUG, which means outputting to the debugger's output window. In some setups, this is enough for making it work, but in others it instead can pop up a dialog asking for which debugger to use. Instead set the mode explicitly to _CRTDBG_MODE_FILE and set the destination to be explicitly to stderr. For setups where the previous code worked correctly, it doesn't make any difference other than that a failed assert prints an additional "abort() has been called" message that wasn't printed before. Differential Revision: https://reviews.llvm.org/D155823
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/test/support/set_windows_crt_report_mode.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/libcxx/test/support/set_windows_crt_report_mode.h b/libcxx/test/support/set_windows_crt_report_mode.h
index b647eaf..d8dd244 100644
--- a/libcxx/test/support/set_windows_crt_report_mode.h
+++ b/libcxx/test/support/set_windows_crt_report_mode.h
@@ -33,9 +33,12 @@
// that setting and instead changes the assertion handler to log to stderr
// instead.
inline int init_crt_report_mode() {
- _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
- _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
- _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
return 0;
}