Linux SPARSE checker discussions
 help / color / mirror / Atom feed
* [PATCH] Adding ignored attribute optimize
@ 2017-06-27 17:21 Christopher Li
  2017-06-29  7:04 ` Luc Van Oostenryck
  0 siblings, 1 reply; 8+ messages in thread
From: Christopher Li @ 2017-06-27 17:21 UTC (permalink / raw)
  To: Linux-Sparse; +Cc: Luc Van Oostenryck

[-- Attachment #1: Type: text/plain, Size: 123 bytes --]

I notice this unknow attribute "__optimize__"when I am looking
sparse checking result on the recent kernel compile.

Chris

[-- Attachment #2: 0001-Adding-ignored-attribute-optimize.patch --]
[-- Type: text/x-patch, Size: 1612 bytes --]

From d8925f125ee8b1cc6eb29f43312b81f3f859374d Mon Sep 17 00:00:00 2001
From: Christopher Li <sparse@chrisli.org>
Date: Fri, 23 Jun 2017 17:13:17 -0700
Subject: [PATCH] Adding ignored attribute optimize

It was used in kvm/vmx.c

Signed-of-By: Christopher Li <sparse@chrisli.org>
---
 parse.c                    |  6 ++++--
 validation/attr-optimize.c | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 validation/attr-optimize.c

diff --git a/parse.c b/parse.c
index 2145479..f665f05 100644
--- a/parse.c
+++ b/parse.c
@@ -607,6 +607,8 @@ static const char *ignored_attributes[] = {
 	"__naked__",
 	"no_instrument_function",
 	"__no_instrument_function__",
+	"no_sanitize_address",
+	"__no_sanitize_address__",
 	"noclone",
 	"__noclone",
 	"__noclone__",
@@ -618,6 +620,8 @@ static const char *ignored_attributes[] = {
 	"nothrow",
 	"__nothrow",
 	"__nothrow__",
+	"optimize",
+	"__optimize__",
 	"regparm",
 	"__regparm__",
 	"section",
@@ -646,8 +650,6 @@ static const char *ignored_attributes[] = {
 	"__warning__",
 	"weak",
 	"__weak__",
-	"no_sanitize_address",
-	"__no_sanitize_address__",
 };
 
 
diff --git a/validation/attr-optimize.c b/validation/attr-optimize.c
new file mode 100644
index 0000000..c45cbe8
--- /dev/null
+++ b/validation/attr-optimize.c
@@ -0,0 +1,16 @@
+
+#define __noclone	__attribute__((__noclone__, __optimize__("no-tracer")))
+
+struct kvm_vcpu;
+
+static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+{
+	__asm__("");
+}
+
+extern void *run;
+void *run = vmx_vcpu_run;
+
+/*
+ * check-name: optimize attributes
+ */
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-03 20:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-27 17:21 [PATCH] Adding ignored attribute optimize Christopher Li
2017-06-29  7:04 ` Luc Van Oostenryck
2017-06-29 21:46   ` Christopher Li
2017-07-01  9:24     ` Luc Van Oostenryck
2017-07-01 22:21       ` Christopher Li
2017-07-02 19:58         ` Luc Van Oostenryck
2017-07-03 18:23           ` Christopher Li
2017-07-03 20:41             ` Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox