Solaris 10 Sun Studio 12 & memcached 1.2.2

Paul Lindner lindner at
Wed Jun 20 01:24:52 UTC 2007

On Tue, Jun 19, 2007 at 10:35:29PM +0200, Trond Norbye wrote:
> William Pool wrote:
> I was able to use the Sun Studio compiler by making the following changes:
> memcached.h line 105:
> I am no expert on this, but I _thought_ that if you specified a constant 
> expression for the array size, it had to be a value greater than zero. 
> Someone with more detailed knowledge may provide a better answer to 
> this. What I did was just to increase the array size to one. I have not 
> _analyzed_ the use of this variable, but my guess after a quick look is 
> that it is just used to calculate an offset.
> 105c105
> <     void * end[0];
> >     void * end[1];

This is a C99 extension. It probably should be expressed as void
*end[].  Can you try this construct instead?

<     void * end[0];
>     void * end[];

This passes all tests on linux and macosx.

Using void *end[1] results in the base data structure growing in size
from 32 to 36 bytes, which is probably not what we want.

Note that this zero-length-array syntax is used to allow for variable
sized structures without using pointers.

> memcached.c:
> You get some compiler warnings for not including signal.h, but the 
> compilation errors comes from the inline keyword added to 
> process_stats_detail. If my memory is correct you cannot call static 
> functions from an inlined function with non-static linkage. If you make 
> process_stats_detail static it will compile and link
> 21a22
> > #include <signal.h>
> 816c817
> < inline void process_stats_detail(conn *c, const char *command) {
> > static inline void process_stats_detail(conn *c, const char *command) {

Ah yes, correct.  I applied this.

> With these modifications I was able to compile and link the source.
> I would be great if someone could correct me if my memory is wrong.. It 
> may be an obsolete cache entry ;-)


Paul Lindner        ||||| | | | |  |  |  |   |   |
lindner at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the memcached mailing list