[PATCH] libcflag: define the "noinline" macro

Bill Wendling
2021-08-26T21:04:12Z

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

Signed-off-by: Bill Wendling <morbo@google.com>
---
lib/libcflat.h | 1 +
x86/pmu_lbr.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/libcflat.h b/lib/libcflat.h
index 97db9e3..a652c76 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -29,6 +29,7 @@
#include <stdbool.h>

#define __unused __attribute__((__unused__))
+#define noinline __attribute__((noinline))

#define xstr(s...) xxstr(s)
#define xxstr(s...) #s
diff --git a/x86/pmu_lbr.c b/x86/pmu_lbr.c
index 3bd9e9f..5ff805a 100644
--- a/x86/pmu_lbr.c
+++ b/x86/pmu_lbr.c
@@ -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;
--
2.33.0.259.gc128427fd7-goog