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 | |
| 6 | namespace 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). |
| 11 | void Die(const char *format, ...) |
| 12 | __attribute__((noreturn)) |
| 13 | __attribute__((format(gnu_printf, 1, 2))); |
| 14 | void VDie(const char *format, va_list args) |
| 15 | __attribute__((noreturn)) |
| 16 | __attribute__((format(gnu_printf, 1, 0))); |
| 17 | |
Brian Silverman | 8d2e56e | 2013-09-23 17:55:03 -0700 | [diff] [blame^] | 18 | // 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. |
| 21 | void SetDieTestMode(bool test_mode); |
| 22 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 23 | } // namespace aos |
| 24 | |
| 25 | #endif // AOS_COMMON_DIE_H_ |