some ideas for new janitorial projects

Eric Pouech pouech-eric at wanadoo.fr
Tue May 18 04:40:52 CDT 2004


I've been toying with some gcc warnings lately, and this could generate 
some new ideas for janitorial tasks.
For example:

o -Wmissing-declarations should point lots of missing APIs declarations 
(I've done it in some cases, and I'm in the process of submitting some 
fixes). We cannot turn this warning always on because there are lots of 
cases where we have global functions without prototypes (most than 2/3 
of them are made out of the 16bit entry points)

o -Wcast-qual should point out all the (const bla*) => (foo*) casts. We 
use quite a bit this, and in some cases it would prevent some errors. 
These are the main cases pointed out by this warning:
	1/ const void* ptr; and then reading a value from ptr (word...) like 
*(WORD*)ptr which should be written *(const WORD*). The warning in this 
case is harmless.
	2/ const void* ptr; and then setting it to another const pointer: const 
WORD* pw = (WORD*)ptr; which should be written pw = (const WORD*)ptr;. 
This warning is harmless if pw is really defined as const, in some cases 
it isn't and this should be fixed.
	3/ const void* ptr; and then setting it to a pointer to a pointer (used 
a lot for qsort/bsearch... callbacks), when dealing with arrays of 
pointers. Here again, what's const is the first pointer, so const foo* f 
= *(const foo**)ptr is wrong, it should be const foo* f = (const foo* 
const*)ptr; This could be harmfull if not declared properly.
Unfortunately, we cannot turn this warning on all the time because some 
C functions implementation would always trigger it (strstr for example), 
unless we use intergral values (not pointer) to cast from the const 
char* to the returned char*), and this is uglier IMO than the warning we 
try to avoid.

Some others warnings could be used as well. Trying also the Intel 
compiler gave lots of interesting warnings (and a tons of not so usefull 
too).

A+



More information about the wine-devel mailing list