Add Pal::message. (#467)
This provides a single place for reporting messages to the user. While here, be consistent about using stderr for things that should go to stderr. We were previously using a mix of stderr and stdout.
This commit is contained in:
@@ -19,7 +19,7 @@ namespace snmalloc
|
||||
{ \
|
||||
current_test = __PRETTY_FUNCTION__; \
|
||||
MessageBuilder<1024> mb{"Starting test: " msg "\n", ##__VA_ARGS__}; \
|
||||
fputs(mb.get_message(), stderr); \
|
||||
Pal::message(mb.get_message()); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ namespace snmalloc
|
||||
do \
|
||||
{ \
|
||||
MessageBuilder<1024> mb{msg "\n", ##__VA_ARGS__}; \
|
||||
fputs(mb.get_message(), stderr); \
|
||||
Pal::message(mb.get_message()); \
|
||||
} while (0)
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#if defined(SNMALLOC_CI_BUILD)
|
||||
# include <pal/pal.h>
|
||||
# if defined(WIN32)
|
||||
# include <ds/bits.h>
|
||||
# include <iostream>
|
||||
@@ -64,7 +65,7 @@ void print_stack_trace()
|
||||
void _cdecl error(int signal)
|
||||
{
|
||||
snmalloc::UNUSED(signal);
|
||||
puts("*****ABORT******");
|
||||
snmalloc::Pal::message("*****ABORT******");
|
||||
|
||||
print_stack_trace();
|
||||
|
||||
@@ -75,7 +76,7 @@ LONG WINAPI VectoredHandler(struct _EXCEPTION_POINTERS* ExceptionInfo)
|
||||
{
|
||||
snmalloc::UNUSED(ExceptionInfo);
|
||||
|
||||
puts("*****UNHANDLED EXCEPTION******");
|
||||
snmalloc::Pal::message("*****UNHANDLED EXCEPTION******");
|
||||
|
||||
print_stack_trace();
|
||||
|
||||
@@ -96,7 +97,6 @@ void setup()
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||
}
|
||||
# else
|
||||
# include <pal/pal.h>
|
||||
# include <signal.h>
|
||||
void error_handle(int signal)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user