login
Header Space

 
 

[PATCH] Fix "identifier redeclared" compilation error with SUN cc.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <gitster@...>
Cc: <raa.lkml@...>, <git@...>, <git@...>, Björn Steinbrink <B.Steinbrink@...>
Date: Wednesday, November 14, 2007 - 9:15 pm

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 here

So 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix Solaris Workshop Compiler issues, Guido Ostkamp, (Wed Nov 14, 4:31 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Alex Riesen, (Wed Nov 14, 4:47 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Junio C Hamano, (Wed Nov 14, 5:25 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Guido Ostkamp, (Wed Nov 14, 7:21 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Alex Riesen, (Wed Nov 14, 7:28 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Junio C Hamano, (Wed Nov 14, 8:30 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Linus Torvalds, (Wed Nov 14, 8:44 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, David Kastrup, (Wed Nov 14, 9:21 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Junio C Hamano, (Wed Nov 14, 11:27 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Linus Torvalds, (Wed Nov 14, 9:53 pm)
Re: [PATCH] Fix Solaris Workshop Compiler issues, Junio C Hamano, (Wed Nov 14, 8:46 pm)
[PATCH] Fix "identifier redeclared" compilation error with S..., Björn Steinbrink, (Wed Nov 14, 9:15 pm)
[PATCH] Add mkdtemp() workaround for Sun Solaris 10, Guido Ostkamp, (Fri Nov 16, 2:59 pm)
[RFH] Solaris portability, Junio C Hamano, (Fri Nov 16, 8:33 pm)
Re: [RFH] Solaris portability, Guido Ostkamp, (Sun Nov 18, 8:08 am)
Re: [RFH] Solaris portability, Junio C Hamano, (Sun Nov 18, 1:46 pm)
speck-geostationary