aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2014-11-16 11:00:15 +0800
committerChristopher Li <sparse@chrisli.org>2015-03-13 10:47:55 -0700
commit0f71312959ed8f7692deaedeb35d7612004f8d72 (patch)
tree41ae7a57cf41cbc1cd4dd5ab20d2c5938d77c497 /validation
parent76a73716e4fd76c81259968a7c7cb2fb73d993d7 (diff)
downloadsparse-dev-0f71312959ed8f7692deaedeb35d7612004f8d72.tar.gz
Ignore pure attribute in assignement
The pure attribute only take effect in function node. There is no way to make a value itself pure. Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/pure-function.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/validation/pure-function.c b/validation/pure-function.c
new file mode 100644
index 00000000..04bb85e4
--- /dev/null
+++ b/validation/pure-function.c
@@ -0,0 +1,16 @@
+
+static __attribute__((__pure__)) int pure1(void)
+{
+ int i = 0;
+ return i;
+}
+
+static __attribute__((__pure__)) void *pure2(void)
+{
+ void *i = (void *)0;
+ return i;
+}
+
+/*
+ * check-name: Pure function attribute
+ */