All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add testcase for missing inline definition
@ 2020-10-25 13:58 Luc Van Oostenryck
  0 siblings, 0 replies; only message in thread
From: Luc Van Oostenryck @ 2020-10-25 13:58 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck

If the address of an inline function is taken, a definition
for this function must be emitted.

However, sparse only do this if this inline function is defined
before it is used.

So add a testcase for this.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/linear/inline-definition.c | 30 +++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 validation/linear/inline-definition.c

diff --git a/validation/linear/inline-definition.c b/validation/linear/inline-definition.c
new file mode 100644
index 000000000000..2918bd5d7527
--- /dev/null
+++ b/validation/linear/inline-definition.c
@@ -0,0 +1,30 @@
+extern void use(void *);
+
+static inline int inl0(int a);
+static inline int inl1(int a);
+
+static inline int inl0(int a)
+{
+	return a;
+}
+
+void foo(void)
+{
+	use(inl0);
+	use(inl1);
+}
+
+static inline int inl1(int a)
+{
+	return a;
+}
+
+/*
+ * check-name: inline-definition
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: inl0:
+ * check-output-contains: inl1:
+ */
-- 
2.29.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-25 13:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-25 13:58 [PATCH] add testcase for missing inline definition Luc Van Oostenryck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.