Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] error: logical && with non-zero constant will always evaluate as

From: Martin Kaiser <lists@xxxxxxxxx>
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