From: Timo Sirainen Date: Tue, 29 Sep 2009 17:21:16 +0000 (-0400) Subject: Added ATTR_HOT and ATTR_COLD macros. Use them in a couple of places. X-Git-Tag: 2.0.alpha1~106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ee43613f6d5225fecae31f174c197a279f48e82;p=thirdparty%2Fdovecot%2Fcore.git Added ATTR_HOT and ATTR_COLD macros. Use them in a couple of places. --HG-- branch : HEAD --- diff --git a/src/lib/data-stack.h b/src/lib/data-stack.h index 6ae0060c61..2eadb4d716 100644 --- a/src/lib/data-stack.h +++ b/src/lib/data-stack.h @@ -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 --git a/src/lib/failures.h b/src/lib/failures.h index b2b4c29fba..e05b15be17 100644 --- a/src/lib/failures.h +++ b/src/lib/failures.h @@ -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); diff --git a/src/lib/macros.h b/src/lib/macros.h index 055ce7573d..3221a6f491 100644 --- a/src/lib/macros.h +++ b/src/lib/macros.h @@ -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 && \