]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added ATTR_HOT and ATTR_COLD macros. Use them in a couple of places.
authorTimo Sirainen <tss@iki.fi>
Tue, 29 Sep 2009 17:21:16 +0000 (13:21 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 29 Sep 2009 17:21:16 +0000 (13:21 -0400)
--HG--
branch : HEAD

src/lib/data-stack.h
src/lib/failures.h
src/lib/macros.h

index 6ae0060c611e4a293ffe6de323d393ba26b435b7..2eadb4d7168173b1ecd19682661f2b13aa4574ad 100644 (file)
@@ -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 \
index b2b4c29fba899d884b77ed1428909796c79eea40..e05b15be173f8aaf454103bfff6411700f1aa4e3 100644 (file)
@@ -41,14 +41,14 @@ extern const char *failure_log_type_prefixes[];
 
 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_addr *ip);
 /* 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);
index 055ce7573df2e7c444b8e72041558b94a99c9498..3221a6f491e39afca11934d9beed346d489b9b53 100644 (file)
 #  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 && \