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] [Wireshark-commits] rev 37601: /trunk/gtk/ /trunk/gtk/: dcer

From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Wed, 08 Jun 2011 16:38:16 -0400
On 6/8/2011 3:34 PM, О©ҐО©ҐО©ҐО©ҐО©ҐО©ҐО©Ґ О©ҐО©ҐО©ҐО©ҐО©ҐО©ҐО©ҐО©Ґ wrote:
Look as "# if __USE_FORTIFY_LEVEL>  0" take place
For example, Fedora 15 /usr/include/sys/cdefs.h contains

/* If fortification mode, we warn about unused results of certain
    function calls which can lead to problems.  */
#if __GNUC_PREREQ (3,4)
# define __attribute_warn_unused_result__ \
    __attribute__ ((__warn_unused_result__))
# if __USE_FORTIFY_LEVEL>  0
#  define __wur __attribute_warn_unused_result__
# endif
#else
# define __attribute_warn_unused_result__ /* empty */
#endif
#ifndef __wur
# define __wur /* Ignore */
#endif

As i hear somewhere, Debian-based distros often set __USE_FORTIFY_LEVEL
higher then others...

May be this is the root of the problem and possible way to resolve it?

It appears that Ubuntu sets -D_FORTIFY_SOURCE=2 [1]

[1] https://wiki.ubuntu.com/CompilerFlags

I sort of like (I think) the idea of having this level of checking altho that then means that things like write and strtol will warn if the return value is not used.

Obviously there's been lots of discussion pro & con about all this (starting at least as early as 2005) (following down the trail from your link).

I haven't yet searched alll the Wireshark source, but I think currently that prefs_dlg.c may be the only place where this is an issue (now that iax2... has been fixed by Anders). As Guy noted, presumably we can do the checking in prefs-dlg.c in a different way.

I've not yet understood how/where Ubuntu actually sets FORTIFY_SOURCE.

Possibly we could/should set this in general when using gcc so we get the same warnings when using GCC no matter what the platform.
(Obviously further research/discussion is required;
For example: what other GCC related default config might be different depending upon the distro ?).


Bill