summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2014-05-06 11:33:41 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2014-05-06 11:33:41 +0100
commit63f51bff4d0ad7d7b160633bce1ae24a4af226e6 (patch)
tree8738f26d79bf3846e7efb1c02df3d44728dc5a37 /tests
parented4470002876df2dd34196d009abb24a69aefb17 (diff)
clang-plugin: Support (optional) and (nullable) attributes
This loosely depends on the GLib patch in bug #719966.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/nonnull.c31
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ab04f2c..eb23d6c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -12,6 +12,7 @@ TESTS = \
gvariant-iter.c \
gvariant-lookup.c \
gvariant-new.c \
+ nonnull.c \
$(NULL)
-include $(top_srcdir)/git.mk
diff --git a/tests/nonnull.c b/tests/nonnull.c
new file mode 100644
index 0000000..d795c00
--- /dev/null
+++ b/tests/nonnull.c
@@ -0,0 +1,31 @@
+/*
+ * No error
+ */
+{
+ guint64 size = g_ascii_strtoull ("some-constant-string", NULL, 10);
+}
+
+/*
+ * No error
+ */
+{
+ const gchar *some_str = "foo";
+ guint64 size = g_ascii_strtoull (some_str, NULL, 10);
+}
+
+/*
+ * No error
+ */
+{
+ const gchar *endptr = NULL;
+ guint64 size = g_ascii_strtoull ("some-constant-string", (gchar **) &endptr, 10);
+}
+
+/*
+ * null passed to a callee which requires a non-null argument
+ * guint64 size = g_ascii_strtoull (NULL, NULL, 10);
+ * ~~~~ ^
+ */
+{
+ guint64 size = g_ascii_strtoull (NULL, NULL, 10);
+}