From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Alex Riesen <raa.lkml@gmail.com>,
Guido Ostkamp <git@ostkamp.fastmail.fm>,
git@vger.kernel.org
Subject: Re: [PATCH] Fix Solaris Workshop Compiler issues
Date: Thu, 15 Nov 2007 01:44:04 +0100 [thread overview]
Message-ID: <20071115004404.GB25021@atjola.homenet> (raw)
In-Reply-To: <7v3av89wq7.fsf@gitster.siamese.dyndns.org>
On 2007.11.14 16:30:08 -0800, Junio C Hamano wrote:
> Björn Steinbrink <B.Steinbrink@gmx.de> writes:
>
> > No, just tried with cc: Sun C 5.7 Patch 117837-06 2005/10/05
> >
> > It's the "struct hack", ie. the incomplete array at the end of
> > delta_index. Still looking for a fix/workaround.
>
> Do you mean the "FLEX_ARRAY" thing?
>
> You can ask for FLEX_ARRAY from the command line of your "make"
> process.
>
> There is this thing in git-compat-util.h
>
> #ifndef FLEX_ARRAY
> #if defined(__GNUC__) && (__GNUC__ < 3)
> #define FLEX_ARRAY 0
> #else
> #define FLEX_ARRAY /* empty */
> #endif
> #endif
>
> The sources are written this way:
>
> struct foo {
> ... other members ...
> char last_member_that_is_flexible[FLEX_ARRAY];
> };
>
> For older gcc, because we know about its lack of support, the
> above turns into:
>
> struct foo {
> ... other members ...
> char last_member_that_is_flexible[0];
> }
>
> But for recent enough compilers that grok the "flexible array
> members", the above expands to:
>
> struct foo {
> ... other members ...
> char last_member_that_is_flexible[];
> }
>
> Maybe your compiler needs -DFLEX_ARRAY=0 in CFLAGS?
Actually, I just created a test-case remotely on a Solaris box in my
university (see below) and didn't compile the actual git code. With the
FAM, cc complains about a redeclared identifier, with a zero-sized
array, it complains that an array cannot be zero-sized...
Seems to be a known bug in Sun Studio 10:
http://forum.java.sun.com/thread.jspa?threadID=5071896&messageID=9263771
Björn
#include <stdio.h>
struct foo;
void bar(const struct foo *, unsigned long);
struct bla {
unsigned long foo;
};
struct foo {
unsigned long val;
struct bla *blas[];
};
void bar(const struct foo *foo, unsigned long val)
{
printf("%lu %lu\n", foo->val, val);
}
int main()
{
struct foo foo;
foo.val = 10;
bar(&foo, 20);
return 0;
}
next prev parent reply other threads:[~2007-11-15 0:44 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-14 20:31 [PATCH] Fix Solaris Workshop Compiler issues Guido Ostkamp
2007-11-14 20:47 ` Alex Riesen
2007-11-14 21:25 ` Junio C Hamano
2007-11-14 23:21 ` Guido Ostkamp
2007-11-14 23:28 ` Alex Riesen
2007-11-15 0:17 ` Björn Steinbrink
2007-11-15 0:30 ` Junio C Hamano
2007-11-15 0:44 ` Björn Steinbrink [this message]
2007-11-15 0:46 ` Junio C Hamano
2007-11-15 0:50 ` Björn Steinbrink
2007-11-15 1:15 ` [PATCH] Fix "identifier redeclared" compilation error with SUN cc Björn Steinbrink
2007-11-15 22:00 ` Guido Ostkamp
2007-11-15 22:15 ` Junio C Hamano
2007-11-15 22:28 ` Guido Ostkamp
2007-11-16 18:59 ` [PATCH] Add mkdtemp() workaround for Sun Solaris 10 Guido Ostkamp
2007-11-17 0:33 ` [RFH] Solaris portability Junio C Hamano
2007-11-18 12:08 ` Guido Ostkamp
2007-11-18 17:46 ` Junio C Hamano
2007-11-16 4:58 ` [PATCH] Fix "identifier redeclared" compilation error with SUN cc Junio C Hamano
2007-11-16 12:55 ` Björn Steinbrink
2007-11-19 17:51 ` Guido Ostkamp
2007-11-20 8:30 ` Junio C Hamano
2007-11-20 17:28 ` Guido Ostkamp
2007-11-20 18:06 ` Guido Ostkamp
2007-11-20 18:26 ` Martin Mares
2007-11-20 20:08 ` Junio C Hamano
2007-11-20 20:09 ` Martin Mares
2007-11-15 0:44 ` [PATCH] Fix Solaris Workshop Compiler issues Linus Torvalds
2007-11-15 1:21 ` David Kastrup
2007-11-15 1:53 ` Linus Torvalds
2007-11-15 3:27 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071115004404.GB25021@atjola.homenet \
--to=b.steinbrink@gmx.de \
--cc=git@ostkamp.fastmail.fm \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=raa.lkml@gmail.com \
/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