git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix Solaris Workshop Compiler issues
@ 2007-11-14 20:31 Guido Ostkamp
  2007-11-14 20:47 ` Alex Riesen
  0 siblings, 1 reply; 31+ messages in thread
From: Guido Ostkamp @ 2007-11-14 20:31 UTC (permalink / raw)
  To: git

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;

^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2007-11-20 20:10 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).