ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Prevent compiler warnings by using "stop on warnings"/"treat

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Wed, 21 Mar 2007 06:18:12 +0100
On Tue, Mar 20, 2007 at 01:01:20PM -0700, Stephen Fisher wrote:
> > So here comes the buildbot into the scene. If we would use a compiler 
> > option like "stop on warnings" (or "treat warnings as errors" or 
> > alike), it would become at least much more obvious if new warnings 
> > were added - the buildbot will get "red". This will also make the time 
> > when a warning is noticed much nearer to the time the code was 
> > added/changed - currently fixing a warning once added is often done 
> > much later than it was introduced (making the fix unnecessarily 
> > difficult).
> 
> > An incremental way to introduce this could be:
> 
> Good ideas!

No, it won't work. I've spent many many hours in the past to get rid of
compiler warnings and it just won't work. While we definitely should try
to get rid of some warnings, fixing warnings on one platform may introduce
warnings on other platforms (or even gcc versions).

> With automake, we just need to put AM_CFLAGS = -Werror in the 
> Makefile.am file in each directory that we're working on.

Yes, it can be technically done, but not in reality.

> > So what's the opinion about this way to improve the Wireshark code 
> > base? Are we willing to produce only warning free code and fixing 
> > warnings that appear on the buildbot?

Not possible.

> I'm willing to work on the Unix warnings.

I've been doing that for a rather long time and mostly (but not
completely) stopped doing that about a year ago. Attached you'll find a
rather hackish script that I use to "classify" the warnings. Maybe
someone is willing to convert this into something less inefficient and
much more readable...

 Ciao
       Joerg


-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.

Attachment: warnings.sh
Description: Bourne shell script