I'm trying to build the BIND-8 name resolver library and am getting the
following error:
/opt/toolset/compiler/FD7/SUNWspro/bin/cc -mt -g
-I/work/smithr/tickets/24256.sbc-leak/MAIN/users/smithr/resolver-te\
st/bind/bind-9.3.1/lib/bind
-I/work/smithr/tickets/24256.sbc-leak/MAIN/users/smithr/resolver-test/bind/b
ind-9.3.1/lib/\
bind/make/../port/solaris/include -I.. -I./../include -D_REENTRANT
-c gai_strerror.c
"gai_strerror.c", line 58: too many initializers for scalar
cc: acomp failed for gai_strerror.c
This is on a Solaris-8 box with the Sun compiler. The offending line of
code is:
static pthread_mutex_t lock = LIBBIND_MUTEX_INITIALIZER;
which, when I run the compile with -E, gets expanded to:
static pthread_mutex_t lock = { { { 0 , 0 , 0 , 0 , 0 } , { { { 0
} } } , 0 } };
pthread_mutex_t in turn is:
typedef struct _pthread_mutex {
struct {
uint16_t __pthread_mutex_flag1;
uint8_t __pthread_mutex_flag2;
uint8_t __pthread_mutex_ceiling;
uint16_t __pthread_mutex_type;
uint16_t __pthread_mutex_magic;
} __pthread_mutex_flags;
union {
struct {
uint8_t __pthread_mutex_pad[8];
} __pthread_mutex_lock64;
struct {
uint32_t __pthread_ownerpid;
uint32_t __pthread_lockword;
} __pthread_mutex_lock32;
upad64_t __pthread_mutex_owner64;
} __pthread_mutex_lock;
upad64_t __pthread_mutex_data;
} pthread_mutex_t;
This looks perfectly reasonable to me. The first five 0's get assigned to
....flag1 through ...magic, the next 0 is __pthread_mutex_pad[0], and the
last 0 is __pthread_mutex_data. Why the compiler error? 2 3882
Roy Smith wrote: I'm trying to build the BIND-8 name resolver library and am getting the following error:
/opt/toolset/compiler/FD7/SUNWspro/bin/cc -mt -g -I/work/smithr/tickets/24256.sbc-leak/MAIN/users/smithr/resolver-te\ st/bind/bind-9.3.1/lib/bind -I/work/smithr/tickets/24256.sbc-leak/MAIN/users/smithr/resolver-test/bind/b ind-9.3.1/lib/\ bind/make/../port/solaris/include -I.. -I./../include -D_REENTRANT -c gai_strerror.c "gai_strerror.c", line 58: too many initializers for scalar cc: acomp failed for gai_strerror.c
This is on a Solaris-8 box with the Sun compiler. The offending line of code is:
static pthread_mutex_t lock = LIBBIND_MUTEX_INITIALIZER;
which, when I run the compile with -E, gets expanded to:
static pthread_mutex_t lock = { { { 0 , 0 , 0 , 0 , 0 } , { { { 0 } } } , 0 } };
It looks like you have an extra set of braces around your initializer,
try this:
static pthread_mutex_t lock = {{ 0, 0, 0, 0, 0 }, {{{0}}}, 0 };
pthread_mutex_t in turn is:
typedef struct _pthread_mutex { struct { uint16_t __pthread_mutex_flag1; uint8_t __pthread_mutex_flag2; uint8_t __pthread_mutex_ceiling; uint16_t __pthread_mutex_type; uint16_t __pthread_mutex_magic; } __pthread_mutex_flags; union { struct { uint8_t __pthread_mutex_pad[8]; } __pthread_mutex_lock64; struct { uint32_t __pthread_ownerpid; uint32_t __pthread_lockword; } __pthread_mutex_lock32; upad64_t __pthread_mutex_owner64; } __pthread_mutex_lock; upad64_t __pthread_mutex_data; } pthread_mutex_t;
This looks perfectly reasonable to me. The first five 0's get assigned to ...flag1 through ...magic, the next 0 is __pthread_mutex_pad[0], and the last 0 is __pthread_mutex_data. Why the compiler error?
Robert Gamble
In article <11**********************@o13g2000cwo.googlegroups .com>,
"Robert Gamble" <rg*******@gmail.com> wrote: It looks like you have an extra set of braces around your initializer, try this:
static pthread_mutex_t lock = {{ 0, 0, 0, 0, 0 }, {{{0}}}, 0 };
I just discovered:
/* Shut up warnings about missing braces */
#define SHUTUP_MUTEX_INITIALIZER 1
#ifdef SHUTUP_MUTEX_INITIALIZER
#define LIBBIND_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
#else
#define LIBBIND_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#endif
I'm not sure which compiler(s) were issuing the warnings, but obviously
that's the problem. Commenting out the first #define solved the problem.
Thanks for the help. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kevin P. Fleming |
last post by:
I've got an enum and a structure:
enum option_type {
O_STRING,
O_BOOL,
O_NUMBER
};
struct option_s {
char *name;
|
by: Skybuck Flying |
last post by:
Hello,
What does Const mean in this c structure ? and what is the delphi equivalent
?
I think const struct just means it can't be modified... is that correct ?
Struct {
Type1 Field1;...
|
by: kimimaro |
last post by:
hi I wonder if array can be work along with structure?
Below are the declaration of my structure
struct employee{
char ID;
char Name;
char Department;
|
by: aarklon |
last post by:
Hi all,
why the following structure initialization is not valid
#include<stdio.h>
struct rec
{
char name;
int age;
};
|
by: Rich |
last post by:
Suppose the following:
typedef void (*funcptrs)(void);
typedef struct {
unsigned int *in;
unsigned int *out;
unsigned int *overrun;
funcptrs myptrs; /* >=1 for ansi */
} yada;
|
by: aaragon |
last post by:
Hi everyone. I'm trying to write a class with policy based design
(Alexandrescu's Modern C++ Design). I'm not a programmer but an
engineer so this is kind of hard for me. Through the use of...
|
by: hobbes992 |
last post by:
Howdy folks,
I've been working on a c project, compiling using gcc, and I've reached a problem. The assignment requires creation of a two-level directory file system. No files have to be added or...
|
by: rocckky |
last post by:
Hi,
i am new to .NET framework so not that knowledgable about managed and unmanaged codes.
The problem i am facing is i need to call a function say fun_test(struct test * A) which is present in...
|
by: jb.simon |
last post by:
Recently I was pinged in a code review about my use of the
initialization method
AStruct myStruct = { 0 } ;
Which initializes all elements of the myStruct to 0.
I was questioned on it because...
|
by: Bill Reid |
last post by:
OK, let's say that have a function menu structure declaration
like this (since I basically do):
typedef struct function_item {
char *descrip;
void(*function)(void);
} t_function_item;
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |