diff mbox series

[kvm-unit-tests,v2,1/5] libcflag: define the "noinline" macro

Message ID 20210908204541.3632269-2-morbo@google.com (mailing list archive)
State New, archived
Headers show
Series Prevent inlining for asm blocks with labels | expand

Commit Message

Bill Wendling Sept. 8, 2021, 8:45 p.m. UTC
Define "noline" macro to reduce the amount of typing for functions using
the "noinline" attribute.

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

Comments

Sean Christopherson Sept. 8, 2021, 9:44 p.m. UTC | #1
On Wed, Sep 08, 2021, Bill Wendling wrote:
> Define "noline" macro to reduce the amount of typing for functions using
> the "noinline" attribute.
> 
> Signed-off-by: Bill Wendling <morbo@google.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>
diff mbox series

Patch

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;