x = t_push(); .. if (t_pop() != x) abort();
*/
-unsigned int t_push(void);
-unsigned int t_pop(void);
+unsigned int t_push(void) ATTR_HOT;
+unsigned int t_pop(void) ATTR_HOT;
/* Simplifies the if (t_pop() != x) check by comparing it internally and
panicking if it doesn't match. */
-void t_pop_check(unsigned int *id);
+void t_pop_check(unsigned int *id) ATTR_HOT;
/* Usage: T_BEGIN { code } T_END */
#define T_BEGIN \
void i_log_type(enum log_type type, const char *format, ...) ATTR_FORMAT(2, 3);
-void i_panic(const char *format, ...) ATTR_FORMAT(1, 2) ATTR_NORETURN;
-void i_fatal(const char *format, ...) ATTR_FORMAT(1, 2) ATTR_NORETURN;
-void i_error(const char *format, ...) ATTR_FORMAT(1, 2);
+void i_panic(const char *format, ...) ATTR_FORMAT(1, 2) ATTR_NORETURN ATTR_COLD;
+void i_fatal(const char *format, ...) ATTR_FORMAT(1, 2) ATTR_NORETURN ATTR_COLD;
+void i_error(const char *format, ...) ATTR_FORMAT(1, 2) ATTR_COLD;
void i_warning(const char *format, ...) ATTR_FORMAT(1, 2);
void i_info(const char *format, ...) ATTR_FORMAT(1, 2);
void i_fatal_status(int status, const char *format, ...)
- ATTR_FORMAT(2, 3) ATTR_NORETURN;
+ ATTR_FORMAT(2, 3) ATTR_NORETURN ATTR_COLD;
/* Change failure handlers. */
#ifndef __cplusplus
/* Call the callback before exit()ing. The callback may update the status. */
void i_set_failure_exit_callback(void (*callback)(int *status));
/* Call the exit callback and exit() */
-void failure_exit(int status) ATTR_NORETURN;
+void failure_exit(int status) ATTR_NORETURN ATTR_COLD;
/* Parse a line logged using internal failure handler */
void i_failure_parse_line(const char *line, struct failure_line *failure);
# define ATTR_WARN_UNUSED_RESULT
# define ATTR_SENTINEL
#endif
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+/* GCC 4.3 and later */
+# define ATTR_HOT __attribute__((hot))
+# define ATTR_COLD __attribute__((cold))
+#else
+# define ATTR_HOT
+# define ATTR_COLD
+#endif
/* C99-style struct member definitions */
#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L && \