Skip to contentSkip to conversation

sparse: add 'gnu_inline' to the ignored attributes

PATCH In review Ramsay Jones 2 participants 2 messages Aug 4, 2014 – Aug 7, 2014 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 2/10 sparse: add 'gnu_inline' to the ignored attributes

Add some more ignored attributes which are used in glibc header files, along with a simple test case which includes all three inline attributes (__gnu_inline__, __always_inline__ and __noinline__).

---
 parse.c                  |  2 ++
 validation/attr-inline.c | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 validation/attr-inline.c
parse.c +2 -0
index 9767e59..69bcf82 100644
@@ -536,6 +536,8 @@ const char *ignored_attributes[] = {
 	"__format__",
 	"format_arg",
 	"__format_arg__",
+	"gnu_inline",
+	"__gnu_inline__",
 	"hot",
 	"__hot__",
         "leaf",
validation/attr-inline.c new file +21 -0
new file mode 100644
index 0000000..1b88ddb
@@ -0,0 +1,21 @@
+
+static inline __attribute__((__always_inline__)) int gt(int lhs, int rhs)
+{
+	return lhs > rhs;
+}
+
+extern inline __attribute__((__gnu_inline__)) int ge(int lhs, int rhs)
+{
+	return lhs >= rhs;
+}
+
+static __attribute__((__warning__("That's junk!"))) __attribute__((__unused__))
+__attribute__((__noinline__))
+void junk(void)
+{
+	__asm__("");
+}
+
+/*
+ * check-name: inline attributes
+ */
Signature · 1 line
2.0.0
maintainer
#1 lore raw
Quoted 4 lines · Ramsay Jones

Add some more ignored attributes which are used in glibc header files, along with a simple test case which includes all three inline attributes (__gnu_inline__, __always_inline__ and __noinline__).

This change looks good.

Chris