Re: [PATCH 1/3] add a check for negate cases on enumerations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 21, 2016 at 10:26:58AM +0100, Frediano Ziglio wrote:
> Not supported by code so trigger an error to avoid invalid usages

There are probably a lot of such cases which are not properly caught
fwiw, but why not for this one.


Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  python_modules/ptypes.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
> index 74f3e55..1f4e068 100644
> --- a/python_modules/ptypes.py
> +++ b/python_modules/ptypes.py
> @@ -686,6 +686,7 @@ class SwitchCase:
>              if v == None:
>                  return "1"
>              elif var_type.is_enum():
> +                assert v[0] == "", "Negation of enumeration in switch is not supported"
>                  checks.append("%s == %s" % (var_cname, var_type.c_enumname_by_name(v[1])))
>              else:
>                  checks.append("%s(%s & %s)" % (v[0], var_cname, var_type.c_enumname_by_name(v[1])))
> -- 
> 2.7.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]