Wireshark-dev: Re: [Wireshark-dev] rev 50749: /trunk/ /trunk/: CMakeLists.txt
From: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Date: Wed, 7 Aug 2013 18:27:48 +0200



On Tue, Jul 23, 2013 at 8:57 PM, Guy Harris <guy@xxxxxxxxxxxx> wrote:

On Jul 22, 2013, at 7:00 AM, Alexis La Goutte <alexis.lagoutte@xxxxxxxxx> wrote:

> I try also in my Ubunux box (12.04) with clang 3.0 ( Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0) Target: x86_64-pc-linux-gnu Thread model: posix )
>
> and i have the following error when i try to build with clang :
>
> [  4%] Building C object wiretap/CMakeFiles/wiretap.dir/file_wrappers.c.o
> /home/alagoutte/wireshark2/wiretap/file_wrappers.c:818:13: error: implicit conversion loses integer precision:
>       '__blksize_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
>                 want = st.st_blksize;
>                      ~ ~~~^~~~~~~~~~

I guess Linux is prepared for the world when files should be read in chunks bigger than 2GB.

I've checked in a change to check whether st.st_blksize <= G_MAXINT and:

        if it is, cast st.st_blksize to int before assigning it;

        if it isn't, just leave "want" at the default value.

Try it now.

> Have also for all file the following warning...
> warning: unknown warning option '-Wpragmas' [-Wunknown-warning-option]

This change:

        http://anonsvn.wireshark.org/viewvc/trunk/CMakeLists.txt?r1=50760&r2=50759&pathrev=50760

*should* have made CMake use -Werror=unknown-warning-option when testing whether -W options are supported if the compiler supports -Werror=unknown-warning-option, so it *should* leave out all -W options that clang doesn't support.

If that's not happening, that needs to be fixed.

Hi,

I have always some errors when i build with clang 3.0 (with cmake or autotools):

dumpcap.c:3981:88: error: implicit conversion loses integer precision: 'const __suseconds_t'
      (aka 'const long') to 'guint32' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
                                                             phdr->ts.tv_sec, phdr->ts.tv_usec,
                                                                              ~~~~~~~~~^~~~~~~
dumpcap.c:3989:73: error: implicit conversion loses integer precision: 'const __suseconds_t'
      (aka 'const long') to 'guint32' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
                                              phdr->ts.tv_sec, phdr->ts.tv_usec,
                                                               ~~~~~~~~~^~~~~~~
wiretap/lanalyzer.c:643:24: error: implicit conversion loses integer precision: 'const __suseconds_t'
      (aka 'const long') to 'gint32' (aka 'int') [-Werror,-Wshorten-64-to-32]
      gint32 usec = a->tv_usec;
             ~~~~   ~~~^~~~~~~

Fixed with add (gint32) cast before tv_usec :

-      gint32 usec = a->tv_usec;
+      gint32 usec = (gint32)a->tv_usec;

I have also a another issue :

dumpcap.c:4273:20: error: array index of '3' indexes past the end of an array
      (that contains 3 elements) [-Werror,-Warray-bounds]
        if (strcmp("-Z", argv[i]) == 0) {
            ~~~~~~~^~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/string2.h:812:21: note: expanded from:
            : __strcmp_cg (s1, s2, __s1_len))                                 \
                           ^
/usr/include/x86_64-linux-gnu/bits/string2.h:885:27: note: expanded from:
                                          (__const char *)  (s1))[3]          \
                                                             ^    ~
But now yet found a fix...