diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-05-06 14:57:29 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-05-06 14:57:29 +0100 |
commit | 76caff87cd9f7989e905db70f598d2c67ea46fb2 (patch) | |
tree | 58aebe01c98b8684d8a1bd757aec4dd4fab64a4e /tests | |
parent | 72fe9085710e7170e88249a112e201fafe37f080 (diff) |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gvariant-new.c | 14 |
1 files changed, 14 insertions, 0 deletions
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 @@ -148,6 +148,13 @@ * No error */ { + floating_variant = g_variant_new ("i", 16); +} + +/* + * No error + */ +{ gint32 some_var = -5; floating_variant = g_variant_new ("i", some_var); } @@ -172,6 +179,13 @@ * No error */ { + floating_variant = g_variant_new ("u", 16); +} + +/* + * No error + */ +{ guint32 some_var = 5; floating_variant = g_variant_new ("u", some_var); } |