From 76caff87cd9f7989e905db70f598d2c67ea46fb2 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 6 May 2014 14:57:29 +0100 Subject: clang-plugin: Automatically promote int to uint with constant varargs If an integer constant is passed as a vararg, it will be passed as a signed integer to the function. For integers less than G_MAXINT this is not a problem (as the bit representations of int and uint are the same to that point). Modify the GVariant checker to accept low-valued signed integers for unsigned integer GVariant elements. --- tests/gvariant-new.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/gvariant-new.c b/tests/gvariant-new.c index 6a787b2..1508654 100644 --- a/tests/gvariant-new.c +++ b/tests/gvariant-new.c @@ -144,6 +144,13 @@ floating_variant = g_variant_new ("i", -16); } +/* + * No error + */ +{ + floating_variant = g_variant_new ("i", 16); +} + /* * No error */ @@ -168,6 +175,13 @@ floating_variant = g_variant_new ("u", G_MAXUINT); } +/* + * No error + */ +{ + floating_variant = g_variant_new ("u", 16); +} + /* * No error */ -- cgit v1.2.3