Skip to content

Commit

Permalink
libutils: remove obsolete macros
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Heider <[email protected]>
  • Loading branch information
axel-h committed Jun 20, 2024
1 parent f98dad1 commit 4574099
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions libutils/include/utils/assume.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

#pragma once

#include <utils/attribute.h>
#include <utils/builtin.h>
#include <utils/stringify.h>

/* This idiom is a way of passing extra information or hints to GCC. It is only
* occasionally successful, so don't think of it as a silver optimisation
Expand All @@ -20,32 +18,3 @@
__builtin_unreachable(); \
} \
} while (0)

/* Indicate to the compiler that wherever this macro appears is a cold
* execution path. That is, it is not performance critical and likely rarely
* used. A perfect example is error handling code. This gives the compiler a
* light hint to deprioritise optimisation of this path.
*/

#ifdef __clang__

/* Avoid warning: 'cold' attribute only applies to functions */
#define COLD_PATH() do { } while(0)
#define HOT_PATH() do { } while(0)

#else /* not __clang__ */

#define COLD_PATH() \
do { \
JOIN(cold_path_, __COUNTER__): COLD UNUSED; \
} while (0)

/* The opposite of `COLD_PATH`. That is, aggressively optimise this path,
* potentially at the expense of others.
*/
#define HOT_PATH() \
do { \
JOIN(hot_path_, __COUNTER__): HOT UNUSED; \
} while (0)

#endif /* [not] __clang__ */

0 comments on commit 4574099

Please sign in to comment.