aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/libgfortran.h
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-08 22:13:26 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-08 22:13:26 +0000
commit3cdf6c425320725cd6ef153e135844a90ebac26f (patch)
tree10fe31ee5216308d32afd19e85f37d8b50a71391 /libgfortran/libgfortran.h
parent292feffe182a72ad4e0915960d64db18d4a6922f (diff)
2014-03-08 Tobias Burnus <burnus@net-b.de>
* libgfortran.h (unlikely, likely): Add usage comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208434 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/libgfortran.h')
-rw-r--r--libgfortran/libgfortran.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index d7e15add3ca..0d6f432a24b 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -97,6 +97,16 @@ typedef off_t gfc_offset;
#define NULL (void *) 0
#endif
+
+/* The following macros can be used to annotate conditions which are likely or
+ unlikely to be true. Avoid using them when a condition is only slightly
+ more likely/less unlikely than average to avoid the performance penalties of
+ branch misprediction. In addition, as __builtin_expect overrides the compiler
+ heuristic, do not use in conditions where one of the branches ends with a
+ call to a function with __attribute__((noreturn)): the compiler internal
+ heuristic will mark this branch as much less likely as unlikely() would
+ do. */
+
#ifndef __GNUC__
#define __attribute__(x)
#define likely(x) (x)