Gnutls Build Error

Simon Josefsson simon at josefsson.org
Tue Sep 2 10:41:46 CEST 2008


Dave Uhring <duhring at charter.net> writes:

> System:  Solaris Express b96 on amd64 x2 4800+
> Compiler: Sun Studio 12
> Configuration: duhring at dirac:~/gnutls-2.4.1$ ./configure --prefix=/usr --disable-nls --disable-rpath --disable-camellia --enable-random-device=/dev/random --with-libiconv-prefix=/usr/gnu --without-libintl-prefix --with-included-libtasn1 --with-included-libcfg --with-libz-prefix=/usr --with-lzo --with-libreadline-prefix=/usr/gnu --with-libgcrypt --with-libgcrypt-prefix=/usr
>
> Compiler reports the following error not seen in gnutls-2.2.5, same system,
> same compiler:
>
>  /opt/SUNWspro/bin/cc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/usr/share/locale\" -I../lgl -I../lgl -I../includes -I../includes -I./x509 -I../libextra -I../lib/openpgp/ -I./opencdk -I../lib/opencdk -I./minitasn1 -I/usr/gnu/include -xO3 -m32 -xarch=native -c gnutls_cipher_int.c  -KPIC -DPIC -o .libs/gnutls_cipher_int.o
> "gnutls_cipher_int.c", line 108: warning: argument #3 is incompatible with prototype:
>         prototype: pointer to const char : "../lgl/gc.h", line 123
>         argument : const pointer to unsigned char
> "gnutls_cipher_int.c", line 110: warning: argument #3 is incompatible with prototype:
>         prototype: pointer to const char : "../lgl/gc.h", line 125
>         argument : const pointer to unsigned char
> "gnutls_cipher_int.c", line 177: void function cannot return value
> cc: acomp failed for gnutls_cipher_int.c
> *** Error code 1
> make: Fatal error: Command failed for target `gnutls_cipher_int.lo'
> Current working directory /export/home/duhring/gnutls-2.4.1/lib
> *** Error code 1
>
> Is a void function really supposed to return a value?

No.  Thanks for the report.  I have applied the patch below.  If you
apply it, does the rest of GnuTLS 2.4.1 build?

If anyone knows how to get gcc to warn about constructs like the one
below, that would help to catch similar problems in the future.  I have
enabled a lot of warnings in the current gnutls dev branch (in fact all
of the warnings in the GCC-4.3 manual except those that generate too
many warnings, see comments in configure.in), but I don't get a warning
on this (the deinit function called return a void value):

void
_gnutls_cipher_deinit (cipher_hd_st * handle)
{
  if (handle != NULL)
    {
      if (handle->registered && handle->hd.rh.ctx != NULL)
	{
	  return handle->hd.rh.cc->deinit (handle->hd.rh.ctx);
	}
      _gnutls_cipher_ops.deinit (handle->hd.gc);
    }
}

Thanks,
/Simon

>From fd702bc2d625ebc02cb15240ac05aadf9f424093 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <simon at josefsson.org>
Date: Tue, 2 Sep 2008 10:26:13 +0200
Subject: [PATCH] Don't return from a void function.
 Reported by Dave Uhring <duhring at charter.net>.

---
 lib/gnutls_cipher_int.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/gnutls_cipher_int.c b/lib/gnutls_cipher_int.c
index badb074..e8f7df7 100644
--- a/lib/gnutls_cipher_int.c
+++ b/lib/gnutls_cipher_int.c
@@ -42,7 +42,7 @@ _gnutls_cipher_init (cipher_hd_st * handle, gnutls_cipher_algorithm_t cipher,
   int ret = GNUTLS_E_INTERNAL_ERROR;
   gnutls_crypto_single_cipher_st *cc = NULL;
 
-  /* check if a cipher has been registered 
+  /* check if a cipher has been registered
    */
   cc = _gnutls_get_crypto_cipher (cipher);
   if (cc != NULL)
@@ -140,7 +140,8 @@ _gnutls_cipher_deinit (cipher_hd_st * handle)
     {
       if (handle->registered && handle->hd.rh.ctx != NULL)
 	{
-	  return handle->hd.rh.cc->deinit (handle->hd.rh.ctx);
+	  handle->hd.rh.cc->deinit (handle->hd.rh.ctx);
+	  return;
 	}
       _gnutls_cipher_ops.deinit (handle->hd.gc);
     }
-- 
1.5.6.3






More information about the Gnutls-devel mailing list