[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -W options in Makefiles

From: Richard Frith-Macdonald
Subject: Re: -W options in Makefiles
Date: Sat, 9 Nov 2002 07:00:57 +0000

On Saturday, November 9, 2002, at 12:29  am, Chris B. Vetter wrote:


I admit I'm paranoid when it comes to compiler warnings, yet I feel the following
suggestion for GNUstep's makefiles makes some sense:

I noticed that GNUstep only uses -Wall, which, in my opinion, is kind of sloppy (sorry) since there are a lot of missing casts, plain wrong parameters, missing and duplicated definitions and so on. Sorry again, but I think there are only a
few who wouldn't agree on that.

So, I suggest to extend the inclusion of -W statements to at least the following:

ADDITIONAL_CPPFLAGS = -Wall -Werror -Wshadow -Wpointer-arith
-Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
-Wnested-externs -Winline

As I said, I'm kinda paranoid - but I'm sure the benefit is obvious - cleaner code
that actually works and doesn't b0rk out because someone passed a float
instead of a pointer, plus a performance increase due to the fact that, eg
NSMakeRect() actually DOES use float instead of int.

I'm aware that this would include a lot of work and correction, however I think
it would be worth it. At least it's something to think about...

I just spent two hours trying this with the GNUstep base library.
In that time I found no bugs.
I found quite a few redundant declarations which would slow compiling trivially. I found cases where changing the code to avoid warnings would make it less readable (pointer arithmetic and avoiding the use of the name 'index' as a loop index because
there is a function of that name, probably others I don't recall),
I found many cases where the warnings supplied by the compiler were simply wrong.

My guess is that there is reasoning behind the set of warning options turned on by -Wall ... simply that the other warnings are likely to do more harm than good.

The result of two hours effort has been a little tidying up. If I had found a single bug I'd have considered that time well spent, but as I didn't, I'd say it was really a waste of time that could have better been used working on documentation or regression
tests.  Perhaps a few of the additional warnings might be worthwhile.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]