brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | #ifndef AOS_COMMON_DIE_H_ |
| 2 | #define AOS_COMMON_DIE_H_ |
| 3 | |
| 4 | #include <stdarg.h> |
| 5 | |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame^] | 6 | #include "aos/common/macros.h" |
| 7 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 8 | namespace 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). |
| 13 | void Die(const char *format, ...) |
| 14 | __attribute__((noreturn)) |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame^] | 15 | __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 1, 2))); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 16 | void VDie(const char *format, va_list args) |
| 17 | __attribute__((noreturn)) |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame^] | 18 | __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 1, 0))); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 19 | |
Brian Silverman | 8d2e56e | 2013-09-23 17:55:03 -0700 | [diff] [blame] | 20 | // 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. |
| 23 | void SetDieTestMode(bool test_mode); |
| 24 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 25 | } // namespace aos |
| 26 | |
| 27 | #endif // AOS_COMMON_DIE_H_ |