summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2014-05-06 14:56:39 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2014-05-06 14:56:39 +0100
commit72fe9085710e7170e88249a112e201fafe37f080 (patch)
tree2b1149d0e5ae44eaeab1e3e545b53d04d25e0e5a /tests
parent6977a14d9d9f074d0196b8abd2fa60388a40a87f (diff)
clang-plugin: Don’t confuse integer constants with NULL
The integer constant 0 can be interpreted as NULL, so only perform NULL pointer checks when the expected type is a pointer.
Diffstat (limited to 'tests')
-rw-r--r--tests/gvariant-new.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/gvariant-new.c b/tests/gvariant-new.c
index 45f1f13..6a787b2 100644
--- a/tests/gvariant-new.c
+++ b/tests/gvariant-new.c
@@ -177,6 +177,14 @@
}
/*
+ * No error
+ */
+{
+ // This could be interpreted as a NULL pointer constant.
+ floating_variant = g_variant_new ("u", 0);
+}
+
+/*
* Expected a GVariant variadic argument of type ‘long’ but saw one of type ‘char *’.
* floating_variant = g_variant_new ("x", "nope");
* ^