[PATCH 2/3] add testcase for return & inline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The linearization of 'return' statements must correctly take
in account some implementation details of the inlining.

As such, it deserves its own testcase.

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

diff --git a/validation/linear/inline-return.c b/validation/linear/inline-return.c
new file mode 100644
index 000000000..b1e4d8446
--- /dev/null
+++ b/validation/linear/inline-return.c
@@ -0,0 +1,24 @@
+static inline int def(void)
+{
+	return 1;
+}
+
+int foo(void)
+{
+	return def();
+}
+
+int bar(void)
+{
+	return def();
+	return 0;
+}
+
+/*
+ * check-name: inline-return.c
+ * check-command: test-linearize -fdump-ir=linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ * check-output-excludes: ret\\..*\\$0
+ */
-- 
2.14.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux