Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15
DORMANTno replies

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

From: Björn Steinbrink <hidden>
Date: 2016-06-15 22:43:51
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

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 <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help