[Gc] boehm-gc patch

Andrew Haley aph at redhat.com
Mon Dec 14 02:42:29 PST 2009


Ben Elliston wrote:

> On Tue, 2009-12-01 at 22:16 +0300, Ivan Maidanski wrote:
> 
>> -#	define SIG_DEL(set, signal) sigdelset(&(set), (signal))
>> -#	define SIG_FILL(set) sigfillset(&set)
>> -#	define SIGSETMASK(old, new) sigprocmask(SIG_SETMASK, &(new), &(old))
>> +#       error undetectable signal API
>>  #   endif
>>  
>> I'm sorry this seems to be version 6.x as there is no SIG_FILL/DEL()
>> in the GC at present. Could you re-post it against the BDWGC CVS.
> 
> Rather than bother to find the relevant code in the CVS tree, I just
> built the whole GC using my new system compiler.  There is not much
> sense chasing these warnings in the version used by GCC, I suppose.
> 
> The only warning I get is:
>   cord/cordxtra.c:577: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
> 
> which I propose to fix with this patch:
> 
> Index: cord/cordxtra.c
> ===================================================================
> RCS file: /cvsroot/bdwgc/bdwgc/cord/cordxtra.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 cordxtra.c
> --- cord/cordxtra.c	10 Oct 2005 22:33:34 -0000	1.1.1.1
> +++ cord/cordxtra.c	14 Dec 2009 00:31:33 -0000
> @@ -574,7 +574,8 @@ CORD CORD_from_file_lazy_inner(FILE * f,
>  	/* world is multithreaded.			*/
>  	char buf[1];
>  
> -	(void) fread(buf, 1, 1, f); 
> +	/* This `if' construct avoids a warning from GCC. */
> +	if (fread(buf, 1, 1, f)) { }
>  	rewind(f);
>      }
>      state -> lf_file = f;

This is rather horrid.  Do we really care so much about compiler warnings
that we will put such contorted code into our programs?

Andrew.


More information about the Gc mailing list