blob: d973b421f3ab84e4f152e998ad82aaad146cf104 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001#ifndef AOS_COMMON_DIE_H_
2#define AOS_COMMON_DIE_H_
3
4#include <stdarg.h>
5
6namespace aos {
7
8// Terminates the task/process and logs a message (without using the logging
9// framework). Designed for use in code that can't use the logging framework
10// (code that can should LOG(FATAL), which calls this).
11void Die(const char *format, ...)
12 __attribute__((noreturn))
13 __attribute__((format(gnu_printf, 1, 2)));
14void VDie(const char *format, va_list args)
15 __attribute__((noreturn))
16 __attribute__((format(gnu_printf, 1, 0)));
17
Brian Silverman8d2e56e2013-09-23 17:55:03 -070018// Turns on (or off) "test mode", where (V)Die doesn't write out files and
19// doesn't print to stdout.
20// Test mode defaults to false.
21void SetDieTestMode(bool test_mode);
22
brians343bc112013-02-10 01:53:46 +000023} // namespace aos
24
25#endif // AOS_COMMON_DIE_H_