Mailing List Archive

gnupg-2.0.19: common/estream.c mixes void and int
While builds of gnupg-2.0.19 were successful on most of my roughly
25 flavors of Unix, compilations fail on two Solaris Intel systems.
The cause appears to be mixing of void and int in the file
common/estream.c in the definitions of the macros
ESTREAM_MUTEX_LOCK() .. ESTREAM_MUTEX_INITIALIZE() in
lines 177--188.

In function es_ftrylockfile() at line 2619, the value of
ESTREAM_TRYLOCK() is returned as an int, but a void cannot
be cast to an int.

Another minor problem is that configure.ac at line 1473 says

*** It is now required to build with support for the
*** GNU Portable Threads Library (Pth).

However, running

% ./configure --help | grep pth
--with-pth-prefix=PFX prefix where GNU Pth is installed (optional)

says that Pth is optional. Either it is optional, or it is
required, but only one can be true.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe@math.utah.edu -
- 155 S 1400 E RM 233 beebe@acm.org beebe@computer.org -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------

_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Re: gnupg-2.0.19: common/estream.c mixes void and int [ In reply to ]
On Wed, 28 Mar 2012 18:06, beebe@math.utah.edu said:

> The cause appears to be mixing of void and int in the file
> common/estream.c in the definitions of the macros
> ESTREAM_MUTEX_LOCK() .. ESTREAM_MUTEX_INITIALIZE() in
> lines 177--188.

okay, the fix is:

# define ESTREAM_MUTEX_LOCK(mutex) \
(estream_pth_killed ? dummy_mutex_call_void ((mutex)) \
- : pth_mutex_acquire (&(mutex), 0, NULL))
+ : (void)pth_mutex_acquire (&(mutex), 0, NULL))

> In function es_ftrylockfile() at line 2619, the value of
> ESTREAM_TRYLOCK() is returned as an int, but a void cannot
> be cast to an int.

Hmmm, I can see the problem. We have:

# define ESTREAM_MUTEX_TRYLOCK(mutex) \
(estream_pth_killed ? dummy_mutex_call_int ((mutex)) \
: ((pth_mutex_acquire (&(mutex), 1, NULL) == TRUE)? 0:-1))

#define ESTREAM_TRYLOCK(stream) ESTREAM_MUTEX_TRYLOCK (stream->intern->lock)

int
es_ftrylockfile (estream_t stream)
{
return ESTREAM_TRYLOCK (stream);
}

Thus, we either call a dummy functions which returns an int
(dummy_mutex_call_int) or the result of the condition which is eitehr o
or -1.

> % ./configure --help | grep pth
> --with-pth-prefix=PFX prefix where GNU Pth is installed (optional)
>
> says that Pth is optional. Either it is optional, or it is
> required, but only one can be true.

The help string is wrong. We need Pth.


Shalom-Salam,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.


_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel