File parse-add-support-for-no_sanitize_-attributes.patch of Package sparse

From: Jiri Slaby <jslaby@suse.cz>
Date: Thu, 4 Aug 2016 15:24:11 +0200
Subject: parse: add support for no_sanitize_* attributes
Patch-mainline: no, submitted

gcc added support for new no_sanitize_* function attributes:
* no_address_safety_analysis
* no_sanitize_address
* no_sanitize_thread
* no_sanitize_undefined

The kernel uses at least no_sanitize_address as of now. So add them
(and their __...__ counterparts) to ignored_attributes as we can
safely ignore them.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 parse.c                       |  8 ++++++++
 validation/attr-no_sanitize.c | 15 +++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 validation/attr-no_sanitize.c

diff --git a/parse.c b/parse.c
index b43d6835528b..c1ce70b2a4e5 100644
--- a/parse.c
+++ b/parse.c
@@ -562,6 +562,14 @@ const char *ignored_attributes[] = {
 	"__naked__",
 	"no_instrument_function",
 	"__no_instrument_function__",
+	"no_address_safety_analysis",
+	"__no_address_safety_analysis__",
+	"no_sanitize_address",
+	"__no_sanitize_address__",
+	"no_sanitize_thread",
+	"__no_sanitize_thread__",
+	"no_sanitize_undefined",
+	"__no_sanitize_undefined__",
 	"noclone",
 	"__noclone",
 	"__noclone__",
diff --git a/validation/attr-no_sanitize.c b/validation/attr-no_sanitize.c
new file mode 100644
index 000000000000..c776027ff202
--- /dev/null
+++ b/validation/attr-no_sanitize.c
@@ -0,0 +1,15 @@
+static void __attribute__((no_sanitize_address)) foo(void)
+{
+}
+
+static void __attribute__((no_sanitize_thread)) bar(void)
+{
+}
+
+static void __attribute__((no_sanitize_undefined)) baz(void)
+{
+}
+
+/*
+ * check-name: attribute no_sanitize_address
+ */
-- 
2.9.2

openSUSE Build Service is sponsored by