login
Header Space

 
 

[PATCH] Fix Solaris Workshop Compiler issues

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Date: Wednesday, November 14, 2007 - 4:31 pm

Hello,

please find below a patch that solves an error when compiling with the 
original Sun Solaris Compiler. When compiling out of the box, the 
following happens:

     CC diff-delta.o
"diff-delta.c", line 314: identifier redeclared: create_delta
 	current : function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void
 	previous: function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void : "delta.h", line 44
cc: acomp failed for diff-delta.c
make: *** [diff-delta.o] Error 2

This is because 'struct delta_index' is declared with no size in delta.h 
and with size in diff-delta.c which does not fit.

When the struct definition is done in the header file as one would 
normally expect, everything compiles ok with exception of a 
mkdtemp()-issue which somebody else already took care of on this list.

Best regards

Guido


diff --git a/delta.h b/delta.h
index 40ccf5a..06af9a7 100644
--- a/delta.h
+++ b/delta.h
@@ -1,8 +1,23 @@
  #ifndef DELTA_H
  #define DELTA_H

-/* opaque object for delta index */
-struct delta_index;
+struct index_entry {
+    const unsigned char *ptr;
+    unsigned int val;
+};
+
+struct unpacked_index_entry {
+    struct index_entry entry;
+    struct unpacked_index_entry *next;
+};
+
+struct delta_index {
+    unsigned long memsize;
+    const void *src_buf;
+    unsigned long src_size;
+    unsigned int hash_mask;
+    struct index_entry *hash[FLEX_ARRAY];
+};

  /*
   * create_delta_index: compute index data from given buffer
diff --git a/diff-delta.c b/diff-delta.c
index 9e440a9..2023e40 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -112,24 +112,6 @@ static const unsigned int U[256] = {
  	0x133eb0ac, 0x6d8b90a1, 0x450d4467, 0x3bb8646a
  };

-struct index_entry {
-	const unsigned char *ptr;
-	unsigned int val;
-};
-
-struct unpacked_index_entry {
-	struct index_entry entry;
-	struct unpacked_index_entry *next;
-};
-
-struct delta_index {
-	unsigned long memsize;
-	const void *src_buf;
-	unsigned long src_size;
-	unsigned int hash_mask;
-	struct index_entry *hash[FLEX_ARRAY];
-};
-
  struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
  {
  	unsigned int i, hsize, hmask, entries, prev_val, *hash_count;
-
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