git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Git.pm: Support for perl/ being built by a different compiler

From
DSDennis Stosberg <dennis@stosberg.net>
Date
Jun 26, 2006, 08:29 UTC
Message-ID
<20060626082939.G215d3ce6@leonov.stosberg.net>
In-Reply-To
<20060626082428.G52c9608e@leonov.stosberg.net>

Sun CC 5.8 fails with a strange error compiling diff-delta.c that looks like an error in Sun's compiler to me:

$ cc -V cc: Sun C 5.8 Patch 121015-02 2006/03/29

$ cc -o diff-delta.o -c -I/opt/gnu/include -D__EXTENSIONS__ \
-DSHA1_HEADER='<openssl/sha.h>' -DNO_STRCASESTR -DNO_STRLCPY \
-DNO_SETENV -DNO_UNSETENV diff-delta.c
"diff-delta.c", line 251: identifier redeclared: create_delta
        current : function(pointer to const struct delta_index \
{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 \
{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 37
cc: acomp failed for diff-delta.c
make: *** [diff-delta.o] Error 2

Yes, the two prototypes are identical. Seems like the compiler has problems with the opaque struct. When I played around with it, I was surprised when I found that Sun CC actually compiled this file after I removed the const qualifier from the first parameter of the create_delta() function. Does anybody have a better explanation than an error in the compiler?

Regards, Dennis

diff --git a/delta.h b/delta.h
index 7b3f86d..ec9147c 100644
--- a/delta.h
+++ b/delta.h
@@ -34,11 +34,12 @@ extern void free_delta_index(struct delt
  * must be freed by the caller.
  */
 extern void *
-create_delta(const struct delta_index *index,
+create_delta(struct delta_index *index,
             const void *buf, unsigned long bufsize,
             unsigned long *delta_size, unsigned long max_delta_size);

-/*
+/*l
+
  * diff_delta: create a delta from source buffer to target buffer
  *
  * If max_delta_size is non-zero and the resulting delta is to be larger
diff --git a/diff-delta.c b/diff-delta.c
index 8b9172a..802be76 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -245,7 +245,7 @@ void free_delta_index(struct delta_index
 #define MAX_OP_SIZE    (5 + 5 + 1 + RABIN_WINDOW + 7)

 void *
-create_delta(const struct delta_index *index,
+create_delta(struct delta_index *index,
             const void *trg_buf, unsigned long trg_size,
             unsigned long *delta_size, unsigned long max_size)
 {
Previous: Dennis StosbergNext: Thomas Glanzmann
Message 16 of 19 in “Git.pm: Support for perl/ being built by a different compiler”
  1. Git.pm: Support for perl/ being built by a different compilerPetr Baudis, Jun 25, 2006
  2. Junio C HamanoJun 25, 2006
  3. Petr BaudisJun 25, 2006
  4. Dennis StosbergJun 26, 2006
  5. Solaris needs inclusion of signal.h for signal()Dennis Stosberg, Jun 26, 2006
  6. Fix pkt-line.h to compile with a non-GCC compilerDennis Stosberg, Jun 26, 2006
  7. "test" in Solaris' /bin/sh does not support -eDennis Stosberg, Jun 26, 2006
  8. Junio C HamanoJun 26, 2006
  9. Dennis StosbergJun 26, 2006
  10. Dennis StosbergJun 26, 2006
  11. Junio C HamanoJun 26, 2006
  12. Makefile fix for SolarisDennis Stosberg, Jun 26, 2006
  13. Add possibility to pass CFLAGS and LDFLAGS specific to the perl subdirDennis Stosberg, Jun 26, 2006
  14. Petr BaudisJul 1, 2006
  15. Dennis StosbergJun 26, 2006
  16. Dennis StosbergJun 26, 2006
  17. Thomas GlanzmannJun 26, 2006
  18. Junio C HamanoJun 26, 2006
  19. Dennis StosbergJun 26, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.