blob: 3c5cca9b7913c05fb4baf7afdf75b754f6291ded [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
Brian Silvermanf7986142014-04-21 17:42:35 -07006#include "aos/common/macros.h"
7
brians343bc112013-02-10 01:53:46 +00008namespace aos {
9
10// Terminates the task/process and logs a message (without using the logging
11// framework). Designed for use in code that can't use the logging framework
12// (code that can should LOG(FATAL), which calls this).
13void Die(const char *format, ...)
14 __attribute__((noreturn))
Brian Silvermanf7986142014-04-21 17:42:35 -070015 __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 1, 2)));
brians343bc112013-02-10 01:53:46 +000016void VDie(const char *format, va_list args)
17 __attribute__((noreturn))
Brian Silvermanf7986142014-04-21 17:42:35 -070018 __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 1, 0)));
brians343bc112013-02-10 01:53:46 +000019
Brian Silverman8d2e56e2013-09-23 17:55:03 -070020// Turns on (or off) "test mode", where (V)Die doesn't write out files and
21// doesn't print to stdout.
22// Test mode defaults to false.
23void SetDieTestMode(bool test_mode);
24
brians343bc112013-02-10 01:53:46 +000025} // namespace aos
26
27#endif // AOS_COMMON_DIE_H_