[PATCH] Fix "identifier redeclared" compilation error with SUN cc.
- From
Björn Steinbrink <b.steinbrink@gmx.de>
- Date
- Nov 15, 2007, 01:15 UTC
- Message-ID
- <1195089303-28085-1-git-send-email-B.Steinbrink@gmx.de>
- In-Reply-To
- <7vy7d08her.fsf@gitster.siamese.dyndns.org>
Some versions of SUN's cc have a bug that causes them to complain about a redeclared identifier when you use a function declaration that takes a struct with a FAM and this struct has only been declared but not yet defined.
IOW, this will fail: struct foo;
void bar(struct foo *);
struct foo {
int v;
long *a[];
}; void bar(struct foo *foo) {} // SUN cc bug strikes hereSo when we detect a SUN cc, we use an array size of 1 to workaround that bug.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> --- Guido, could you please test this patch?
I have no clue which versions of SUN's cc are affected, so I simply enabled the workaround for all versions. Someone with more knowledge about that should probably limit the check to only do that for the broken versions.
git-compat-util.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h index ede9408..c3ff4b4 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -6,6 +6,8 @@ #ifndef FLEX_ARRAY #if defined(__GNUC__) && (__GNUC__ < 3) #define FLEX_ARRAY 0 +#elif defined(sun) || defined(__SUN__) +#define FLEX_ARRAY 1 #else #define FLEX_ARRAY /* empty */ #endif
-- 1.5.3.5.643.g40e25