[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [PATCH] build: Fix build with older gcc



On 12/19/2016 04:15 PM, Eric Blake wrote:
> gcc 4.4.7 (hello RHEL 6) complains about redefinition of typedefs,
> as in:
> 
> gcc -std=gnu99 -DHAVE_CONFIG_H -I.  -DSYSCONFDIR='"/usr/local/etc"'  -g -O2  -g -O2 -MT nbd_client-buffer.o -MD -MP -MF .deps/nbd_client-buffer.Tpo -c -o nbd_client-buffer.o `test -f 'buffer.c' || echo './'`buffer.c
> buffer.c:39: error: redefinition of typedef ‘buffer_t’
> buffer.h:31: note: previous declaration of ‘buffer_t’ was here
> 
> The .c file only has to declare the struct being typedef'd, not
> repeat the typedef declaration.
> 
> Signed-off-by: Eric Blake <eblake@...696...>
> ---
>  buffer.c        | 4 ++--
>  crypto-gnutls.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

Ping; this problem is still present.

> 
> diff --git a/buffer.c b/buffer.c
> index e08efd8..491ff87 100644
> --- a/buffer.c
> +++ b/buffer.c
> @@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
> 
>  #include "buffer.h"
> 
> -typedef struct buffer
> +struct buffer
>  {
>    char *buf;
>    ssize_t size;
> @@ -36,7 +36,7 @@ typedef struct buffer
>    ssize_t ridx;
>    ssize_t widx;
>    int empty;
> -} buffer_t;
> +};
> 
>  /* the buffer is organised internally as follows:
>   *
> diff --git a/crypto-gnutls.c b/crypto-gnutls.c
> index d885250..9ce394d 100644
> --- a/crypto-gnutls.c
> +++ b/crypto-gnutls.c
> @@ -53,7 +53,7 @@ OTHER DEALINGS IN THE SOFTWARE.
> 
>  #define PRIORITY "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2"
> 
> -typedef struct tlssession
> +struct tlssession
>  {
>    gnutls_certificate_credentials_t creds;
>    gnutls_session_t session;
> @@ -62,7 +62,7 @@ typedef struct tlssession
>    int (*erroutfn) (void *opaque, const char *format, va_list ap);
>    int debug;
>    void *opaque;
> -} tlssession_t;
> +};
> 
>  #define BUF_SIZE 65536
>  #define BUF_HWM ((BUF_SIZE*3)/4)
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: