bug-guile
[Top][All Lists]
Advanced

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

[bug #29395] build fails on HP-UX 11.31: excess elements in array initia


From: Alexander Gattin
Subject: [bug #29395] build fails on HP-UX 11.31: excess elements in array initializer
Date: Wed, 31 Mar 2010 13:22:07 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.18) Gecko/2010021720 Iceweasel/3.0.6 (Debian-3.0.6-3)

URL:
  <http://savannah.gnu.org/bugs/?29395>

                 Summary: build fails on HP-UX 11.31: excess elements in
array initializer
                 Project: Guile
            Submitted by: xrgtn
            Submitted on: Wed 31 Mar 2010 04:22:06 PM EEST
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

address@hidden:~/src/guile-1.8.7/libguile > gcc -DHAVE_CONFIG_H -I.. -I.. -I..
-D_XOPEN_SOURCE=600 -I/comptel/ilink/xxx/include -D_XOPEN_SOURCE=600
-I/comptel/ilink/xxx/include -D_REENTRANT -pthread -g -O2 -Wall
-Wmissing-prototypes -Werror -MT libguile_la-async.lo -MD -MP -MF
.deps/libguile_la-async.Tpo -c async.c  -fPIC -DPIC -o
.libs/libguile_la-async.o
async.c:162: warning: excess elements in array initializer
async.c:162: warning: (near initialization for `async_mutex.__m_short')
async.c:162: warning: excess elements in array initializer
async.c:162: warning: (near initialization for `async_mutex.__m_short')
... above warnings are repeated up to 44 total warning lines ...

The statement that produces this warning/error (please note that I use gcc,
and Makefile wuns it with -Wall -Werror) is the next one:

static scm_i_pthread_mutex_t async_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;

SCM_I_PTHREAD_MUTEX_INITIALIZER is [wrongly] autocofigured as
{PTHREAD_HPUX_INITIALIZER};

The pthread_mutex_t is defined on HP-UX this way:
#  ifdef __LP64__
#    define __MPOINTER          void    *__m_ptr
#    define __POINTER_SET               ((void *) 1LL)
#  else
#    define __MPOINTER          int     __m_pad; \
                                void    *__m_ptr
#    define __POINTER_SET               0, ((void *) 1L)
#  endif

struct __pthread_mutex {
        short           __m_short[2];
        int             __m_int;
        int             __m_int1[4];
        __MPOINTER;
        int             __m_int2[2];
        int             __m_int3[4];
        short           __m_short2[2];
        int             __m_int4[5];
        int             __m_int5[2];
};

typedef struct __pthread_mutex pthread_mutex_t;

You can see that it is a complex struct (struct that contains arrays). But
HP-UX's initializer is flat list:

#define __SPNLCK_INITIALIZER \
        1, 1, 1, 1, \
        __POINTER_SET, \
        1, \
        0

#define PTHREAD_MUTEX_INITIALIZER  { \
        __PTHREAD_MUTEX_VALID, 0, \
        (PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE), \
        __SPNLCK_INITIALIZER, \
        0, 0, -1, 0, \
        0, __LWP_MTX_VALID, 0, 1, 1, 1, 1, \
        0, 0 \
        }

gcc would like the initializer to have nested curly braces for every array
that's nested in the pthread_mutex_t struct, like this:

#define PTHREAD_MUTEX_INITIALIZER2 { \
        {__PTHREAD_MUTEX_VALID, 0}, \
        (PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE), \
        {1, 1, 1, 1}, \
        __POINTER_SET, \
        {1, 0}, \
        {0, 0, -1, 0}, \
        {0, __LWP_MTX_VALID}, {0, 1, 1, 1, 1}, \
        {0, 0} \
        }

And then everything will be fine.

There are 2 problems, though:

1. we cannot modify system HP-UX headers (but it's OK to override system
pthread.h with manually hacked
gcc/ia64-hp-hpux11.31/3.4.6/include/sys/pthread.h)

2. ./configure tries to solve the problem in completely broken way. IMHO the
'excess element' is much more dangerous warning than 'missing braces' one
(another workaround is to configure and build guile with
CFLAGS="-Wno-missing-braces")

I think ./configure should be changed to try PTHREAD_MUTEX_INITIALIZER _both_
with and without braces. And probably with both -Wno-missing-braces and
-Wmissing-braces CFLAGS.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 31 Mar 2010 04:22:06 PM EEST  Name: pthread.h.patch  Size: 4kB  
By: xrgtn

<http://savannah.gnu.org/bugs/download.php?file_id=20075>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29395>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]