Skip to contentSkip to conversation

libcflag: define the "noinline" macro

PATCH Superseded Bill Wendling 2 participants 2 messages Aug 26, 2021 – Aug 27, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libcflag: define the "noinline" macro

Define "noline" macro to reduce the amount of typing for functions using the "noinline" attribute.

---
 lib/libcflat.h | 1 +
 x86/pmu_lbr.c  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
lib/libcflat.h +1 -0
index 97db9e3..a652c76 100644
@@ -29,6 +29,7 @@
 #include <stdbool.h>
 
 #define __unused __attribute__((__unused__))
+#define noinline __attribute__((noinline))
 
 #define xstr(s...) xxstr(s)
 #define xxstr(s...) #s
x86/pmu_lbr.c +2 -2
index 3bd9e9f..5ff805a 100644
@@ -16,14 +16,14 @@
 
 volatile int count;
 
-static __attribute__((noinline)) int compute_flag(int i)
+static noinline int compute_flag(int i)
 {
 	if (i % 10 < 4)
 		return i + 1;
 	return 0;
 }
 
-static __attribute__((noinline)) int lbr_test(void)
+static noinline int lbr_test(void)
 {
 	int i;
 	int flag;
Signature · 1 line
2.33.0.259.gc128427fd7-goog
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Bill Wendling

Define "noline" macro to reduce the amount of typing for functions using the "noinline" attribute.

---

For your own sanity, you'll probably want to send this as part of your other series to fix clang's zealous inlining, there's a decent chance Paolo won't get to this for several weeks.