xmllite: Avoid warning in test_read_state related to -1 not being in XmlReadState.

Nikolay Sivov nsivov at codeweavers.com
Sat Nov 4 15:46:57 CDT 2017


On 11/03/2017 01:26 AM, Gerald Pfeifer wrote:

> Hi Nikolay and others,
>
> the patch below avoids a warning of the kind
>
>    reader.c:276:20: warning: comparison of constant -1 with expression of type
>        'XmlReadState' (aka 'enum XmlReadState') is always false
>        [-Wtautological-constant-out-of-range-compare]
>      if (exp_broken == -1)
>          ~~~~~~~~~~ ^  ~~
>
> which clang issues, so I hope it can be included?
>
> Gerald
>
>
> Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
> ---
>   dlls/xmllite/tests/reader.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c
> index 0f03c3b42e..2a93a76ddb 100644
> --- a/dlls/xmllite/tests/reader.c
> +++ b/dlls/xmllite/tests/reader.c
> @@ -273,7 +273,7 @@ static void test_read_state(IXmlReader *reader, XmlReadState expected,
>       state = -1; /* invalid state value */
>       IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, &state);
>   
> -    if (exp_broken == -1)
> +    if (exp_broken == (XmlReadState)-1)
>           broken_state = FALSE;
>       else
>           broken_state = broken(exp_broken == state);
Hi, Gerald.

Is this warning enabled by default in some release clang version? I'm 
not necessarily opposed in silencing it like that, but I imagine you'll 
see many more instances like that, and if it's not default set of 
warnings I don't know if we should bother.



More information about the wine-devel mailing list