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

Wireshark-dev: Re: [Wireshark-dev] Time shift patch causes compile error

From: Martin Kaiser <lists@xxxxxxxxx>
Date: Sun, 14 Aug 2011 15:11:52 +0200
Hi Stig, all,

Thus wrote Stig Bj�rlykke (stig@xxxxxxxxxxxxx):

> Should be fixed in revision 38523.

> Other issues with Time Shift should be put in bug 6179:
> https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6179

I get a warning (treated as an error) when I compile on Debian Lenny

TShark 1.7.0

Copyright 1998-2011 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with GLib 2.16.6, with libpcap 0.9.8, with libz 1.2.3.3,
without POSIX capabilities, with threads support, without libpcre, without SMI,
without c-ares, without ADNS, without Lua, with Python 2.5.2, with GnuTLS 2.4.2,
with Gcrypt 1.4.1, with MIT Kerberos, without GeoIP.

Running on Linux 2.6.29.1, with locale en_US, with libpcap version 0.9.8, with
libz 1.2.3.3.

Built using gcc 4.3.2.


The error is as follows

gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../wiretap    -I/usr/local/include
'-DPLUGIN_DIR="/usr/local/lib/wireshark/plugins/1.7.0"' -Werror -DINET6
-DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES
-DGTK_DISABLE_SINGLE_INCLUDES -D_FORTIFY_SOURCE=2
-D_U_="__attribute__((unused))" -g -O2 -Wall -W -Wextra
-Wdeclaration-after-statement -Wendif-labels -Wpointer-arith
-Wno-pointer-sign -Warray-bounds -Wcast-align -Wformat-security
-Wold-style-definition -I/usr/local/include -D_REENTRANT -pthread
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2
-I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/pixman-1
-MT libui_a-time_shift_dlg.o -MD -MP -MF
.deps/libui_a-time_shift_dlg.Tpo -c -o libui_a-time_shift_dlg.o `test -f
'time_shift_dlg.c' || echo './'`time_shift_dlg.c
cc1: warnings being treated as errors
time_shift_dlg.c: In function 'action_timeshift':
time_shift_dlg.c:583: error: implicit declaration of function 'truncl'
time_shift_dlg.c:583: error: incompatible implicit declaration of
built-in function 'truncl'
time_shift_dlg.c: In function 'timestring2nstime':
time_shift_dlg.c:672: error: incompatible implicit declaration of
built-in function 'truncl'
time_shift_dlg.c: In function 'calcNT3':
time_shift_dlg.c:781: error: incompatible implicit declaration of
built-in function 'truncl'



This seems to work on Fedora Core 15 with gcc 4.6.0.

I'm not sure if my system config or the code is at fault. truncl isn't
defined anywhere in /usr/include/* except for C++ header files.
Apparently, it's a gcc builtin function. I have no idea what parameters
it expects. You're passing it long doubles, this is in line with the
manpage.

If I enable your define for windows

#define truncl(ld) floorl(ld)

things work ok for me. Should that be enabled for older gccs as well or
are you aware of gcc settings that make it define truncl() in the standard
way?

Best regards,

   Martin