1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-30 11:22:14 +03:00

Enable __attribute__((cold)) only for GCC 4.3 and later.

This attribute was introduced in bzr revision-id
marko.makela@oracle.com-20110405073758-b8y733yvkqum940i
and caused older GCC versions to emit warnings.
This commit is contained in:
Marko Mäkelä
2011-04-06 09:22:36 +03:00
parent c3a82174dc
commit af7d9929fa
4 changed files with 16 additions and 3 deletions

View File

@@ -109,7 +109,7 @@ os_thread_exit(
/*===========*/
void* exit_value) /*!< in: exit value; in Windows this void*
is cast as a DWORD */
__attribute__((cold, noreturn));
UNIV_COLD __attribute__((noreturn));
/*****************************************************************//**
Returns the thread identifier of current thread.
@return current thread identifier */

View File

@@ -255,6 +255,19 @@ easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */
#else
# define UNIV_INTERN
#endif
#if defined __GNUC__ && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
/** Starting with GCC 4.3, the "cold" attribute is used to inform the
compiler that a function is unlikely executed. The function is
optimized for size rather than speed and on many targets it is placed
into special subsection of the text section so all cold functions
appears close together improving code locality of non-cold parts of
program. The paths leading to call of cold functions within code are
marked as unlikely by the branch prediction mechanism. optimize a
rarely invoked function for size instead for speed. */
# define UNIV_COLD __attribute__((cold))
#else
# define UNIV_COLD /* empty */
#endif
#ifndef UNIV_MUST_NOT_INLINE
/* Definition for inline version */

View File

@@ -53,7 +53,7 @@ ut_dbg_assertion_failed(
const char* expr, /*!< in: the failed assertion */
const char* file, /*!< in: source file containing the assertion */
ulint line) /*!< in: line number of the assertion */
__attribute__((nonnull(2), cold));
UNIV_COLD __attribute__((nonnull(2)));
#if defined(__WIN__) || defined(__INTEL_COMPILER)
# undef UT_DBG_USE_ABORT

View File

@@ -276,7 +276,7 @@ void
ut_print_timestamp(
/*===============*/
FILE* file) /*!< in: file where to print */
__attribute__((nonnull, cold));
UNIV_COLD __attribute__((nonnull));
/**********************************************************//**
Sprintfs a timestamp to a buffer, 13..14 chars plus terminating NUL. */
UNIV_INTERN