cc compile error: identifier redeclared

Bug #408441 reported by SoloTurn on 2009-08-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Medium
John A Meinel

Bug Description

/opt/studio/SOS11/SUNWspro/bin/cc -DNDEBUG -O -xO3 -xarch=v8 -I/opt/csw/include -I/opt/csw/include -xcode=pic32 -I/opt/csw/include/python2.6 -c bzrlib/diff-delta.c -o build/temp.solaris-2.10-sun4v-2.6/bzrlib/diff-delta.o
"bzrlib/diff-delta.c", line 716: warning: argument #1 is incompatible with prototype:
        prototype: pointer to pointer to unsigned char : "bzrlib/delta.h", line 90
        argument : pointer to pointer to const unsigned char
"bzrlib/diff-delta.c", line 866: identifier redeclared: create_delta
        current : function(pointer to const struct delta_index {unsigned long memsize, pointer to const struct source_info {..} last_src, unsigned int hash_mask, unsigned int num_entries, pointer to struct index_entry {..} last_entry, 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 struct source_info {..} last_src, unsigned int hash_mask, unsigned int num_entries, pointer to struct index_entry {..} last_entry, 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 : "bzrlib/delta.h", line 76
cc: acomp failed for bzrlib/diff-delta.c

  Cannot build extension "bzrlib._groupcompress_pyx".

Related branches

SoloTurn (soloturn) wrote :

would a switch to http://cython.org/ help, instead of pyrex?

John A Meinel (jameinel) wrote :

Well, it wouldn't help with *this* because this is just a small bug in some raw C code. Namely we originally had the function as:

int function(const unsigned char **, const unsigned char*)

but we had troubles because C doesn't actually allow:

unsigned char **mypointer

function(mypointer, ...)

Because it claims it can't pass an "unsigned char **" to "const unsigned char **".

So we changed the api to:
int function(unsigned char **, const unsigned char*)

and then update some callers, but apparently missed this one. I'm not really sure why gcc wouldn't always fail with:

const unsigned char *buffer;
function(&buffer, ...)

Certainly 'const' and ** don't play nicely together. (Versus 'const char *' which can be auto consted if a 'char *' is passed.)

Part of the problem is that pyrex doesn't natively have any idea what "const" means, and the designer has explicitly rejected the idea of supporting it. (He feels it is a mis-feature of the C language.) I'm pretty sure cython doesn't yet support it either anyway.

(So the change in the api was necessitated by pyrex/cython, and we just forgot to update some C code that was still using it in the old fashion.)

I'm attaching a branch which just does a cast, since we know it is safe to do.

Changed in bzr:
assignee: nobody → John A Meinel (jameinel)
importance: Undecided → Medium
milestone: none → 1.18
status: New → Fix Committed
Martin Pool (mbp) on 2009-08-10
Changed in bzr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers