Wireshark mailing list archives

error: logical && with non-zero constant will always evaluate as true


From: Martin Kaiser <lists () kaiser cx>
Date: Sat, 29 Dec 2012 16:17:44 +0100

Dear all,

I get this warning (error) when I compile svn head

peektagged.c: In function ???wtap_file_read_till_separator???:
peektagged.c:150: error: logical ???&&??? with non-zero constant
will always
evaluate as true
make[2]: *** [libwiretap_la-peektagged.lo] Error 1


The offending line is

   if (strchr (separators, c) != NULL)

which seems to evaluate on my system (debian squeeze) to something like

  (__extension__ (__builtin_constant_p (c) && !__builtin_constant_p (s) \
        && (c) == '\0'                    \
        ? (char *) __rawmemchr (s, c)                 \
        : __builtin_strchr (s, c)))


I still don't understand the problem. c is not constant, it's read from
a file.

Commenting out 

AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wlogical-op)

in configure.ac will stop the warning.

Any ideas how to fix this properly?

Thanks,

   Martin


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: