summaryrefslogtreecommitdiff
path: root/usr/src/tools/smatch/src/validation/Waddress-function.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/tools/smatch/src/validation/Waddress-function.c')
-rw-r--r--usr/src/tools/smatch/src/validation/Waddress-function.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/usr/src/tools/smatch/src/validation/Waddress-function.c b/usr/src/tools/smatch/src/validation/Waddress-function.c
new file mode 100644
index 0000000000..fccbe2d89c
--- /dev/null
+++ b/usr/src/tools/smatch/src/validation/Waddress-function.c
@@ -0,0 +1,17 @@
+extern void func(void);
+
+int global_function(void)
+{
+ if (func)
+ return 1;
+ return 0;
+}
+
+/*
+ * check-name: Waddress-function
+ * check-command: sparse -Wno-decl -Waddress $file
+ *
+ * check-error-start
+Waddress-function.c:5:13: warning: the address of a function will always evaluate as true
+ * check-error-end
+ */