Re: [Sablevm-developer] Errno usage considered harmful?!
Brought to you by:
egagnon
From: Clark V. <cl...@CS...> - 2004-03-10 13:44:29
|
I have some guesses, below. -- ttfn, clark cl...@cs... On Wed, 10 Mar 2004, Grzegorz B. Prokopski wrote: > Hi all, > > I have strange problems with compiler warnings: > > 1. If I add: > #include <errno.h> > extern int errno; > I get such warning: > java_lang_ProcessImpl.c:24: warning: function declaration isn't a > prototype It would help to know which line is line 24, but here's something that may be worth checking: Although the extern declaration should be fine, errno may be declared as a macro rather than a simple variable --- particularly with multithreaded code, where errno's exist for each separate thread. Try just using the include and removing the "extern int errno;" statement. > 2. In interrupt() implementation I use a pointer to pthread_cond_t: > volatile pthread_cond_t *sleeping_on_cond; > I also keep getting this warning: > java_lang_VMThread.c:342: warning: passing arg 1 of > `pthread_cond_broadcast' discards qualifiers from pointer target type > which is such code: > pthread_cond_broadcast (env_other->thread.sleeping_on_cond); The prototype for cond_broadcast doesn't expect a volatile type for the argument, so that qualifier is being discarded when you call the function. An explicit cast may eliminate the warning, but the problem is that the cond_broadcast code was not compiled assuming volatile input arguments. If that's a problem then you'll need to re-examine why you need volatile in sleeping_on_cond. > Not sure how to deal with these two. Suggestions are very welcomed. [*] > > Cheers, > > Grzegorz B. Prokopski > > [*] Like a good RTFM, for ex. > > |