dovecot-2.0: Added ATTR_HOT and ATTR_COLD macros. Use them in a ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 29 20:21:44 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/12089b6343bf
changeset: 9946:12089b6343bf
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 29 13:21:16 2009 -0400
description:
Added ATTR_HOT and ATTR_COLD macros. Use them in a couple of places.

diffstat:

3 files changed, 16 insertions(+), 8 deletions(-)
src/lib/data-stack.h |    6 +++---
src/lib/failures.h   |   10 +++++-----
src/lib/macros.h     |    8 ++++++++

diffs (67 lines):

diff -r 53b2a88ee6d0 -r 12089b6343bf src/lib/data-stack.h
--- a/src/lib/data-stack.h	Tue Sep 29 10:15:18 2009 -0400
+++ b/src/lib/data-stack.h	Tue Sep 29 13:21:16 2009 -0400
@@ -39,11 +39,11 @@ extern unsigned int data_stack_frame;
 
    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 \
diff -r 53b2a88ee6d0 -r 12089b6343bf src/lib/failures.h
--- a/src/lib/failures.h	Tue Sep 29 10:15:18 2009 -0400
+++ b/src/lib/failures.h	Tue Sep 29 13:21:16 2009 -0400
@@ -41,14 +41,14 @@ extern const char *failure_log_type_pref
 
 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
@@ -105,7 +105,7 @@ void i_set_failure_ip(const struct ip_ad
 /* 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);
diff -r 53b2a88ee6d0 -r 12089b6343bf src/lib/macros.h
--- a/src/lib/macros.h	Tue Sep 29 10:15:18 2009 -0400
+++ b/src/lib/macros.h	Tue Sep 29 13:21:16 2009 -0400
@@ -129,6 +129,14 @@
 #  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 && \


More information about the dovecot-cvs mailing list