From: Alexander Gattin <INVALID.NOREPLY@gnu.org>
To: Alexander Gattin <xrgtn@yandex.ru>, bug-guile@gnu.org
Subject: [bug #29395] build fails on HP-UX 11.31: excess elements in array initializer
Date: Wed, 31 Mar 2010 13:22:07 +0000 [thread overview]
Message-ID: <20100331-162206.sv58897.95068@savannah.gnu.org> (raw)
In-Reply-To:
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:
ilink@tunis:~/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 other threads:[~2010-03-31 13:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100331-162206.sv58897.95068@savannah.gnu.org \
--to=invalid.noreply@gnu.org \
--cc=bug-guile@gnu.org \
--cc=xrgtn@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).