Subject: Re: toolchain/22118: make won't compile with -Wcast-qual -Wstrict-prototypes and more
To: Alan Barrett <apb@cequrux.com>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 07/14/2003 08:53:57
Thanks for the feedback.  After getting maybe 20% of make to compile 
with these warnings, I decided it just wasn't worth it.
I'll probably re-apply some of the patches that make sense, but 
retro-fitting const-correctness would require a major re-write or
so many DECONST()'s that its a joke.

>> -	 arch = ArchFindMember(archive, member, &sarh, "r");
>> +	 arch = ArchFindMember(archive, member, &sarh, r_mode);
>>  
>>  	 if (arch == (FILE *)NULL) {
>>  	    return ((struct ar_hdr *)NULL);

>This kind of change makes the code much more difficult to read.
>Perhaps ArchFindMember() should be change to take a const 4th argument?

I tried that.  That's what I usually do first, chase args making them const
until you find someone who actually modifies something.
Of course this typically makes the number of errors explode until you
fixed all the callers, but gives the closest to correct result.

But eventually you find youself needing to do  free(DECONST(pointer))
at which point it all starts to seem silly ;-)

--sjg