Skip to contentSkip to conversation

wcwidth redeclaration

PATCH In review Amos Waterland 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wcwidth redeclaration

Build fails for git 1.5.1.3 on AIX, with the message:

utf8.c:66: error: conflicting types for 'wcwidth' /.../lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.3/include/string.h:266: error: previous declaration of 'wcwidth' was here

Here is a patch that fixes it for me. If there is a different way that is preferred, please let me know.

---

 utf8.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utf8.c renamed from utf8.c.orig +2 -2
@@ -62,7 +62,7 @@
  * in ISO 10646.
  */
 
-static int wcwidth(ucs_char_t ch)
+static int git_wcwidth(ucs_char_t ch)
 {
 	/*
 	 * Sorted list of non-overlapping intervals of non-spacing characters,
@@ -207,7 +207,7 @@
 		return 0;
 	}
 
-	return wcwidth(ch);
+	return git_wcwidth(ch);
 }
 
 int is_utf8(const char *text)
#1 lore raw
Quoted 7 lines · [email protected] (Amos Waterland) writes:

Build fails for git 1.5.1.3 on AIX, with the message:

utf8.c:66: error: conflicting types for 'wcwidth' /.../lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.3/include/string.h:266: error: previous declaration of 'wcwidth' was here

Here is a patch that fixes it for me. If there is a different way that is preferred, please let me know.

It's static in that file, so renaming our version to our own name as you did is perfectly good.

Thanks for helping, as not many people seem to be on AIX on this list.

#2 lore raw

Hi,

Quoted 7 lines · Junio C Hamano
Quoted 5 lines · [email protected] (Amos Waterland) writes:

Build fails for git 1.5.1.3 on AIX, with the message:

utf8.c:66: error: conflicting types for 'wcwidth' /.../lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.3/include/string.h:266: error: previous declaration of 'wcwidth' was here

Quoted 8 lines
Quoted 2 lines

Here is a patch that fixes it for me. If there is a different way that is preferred, please let me know.

It's static in that file, so renaming our version to our own name as you did is perfectly good.

Thanks for helping, as not many people seem to be on AIX on this list.

Thanks indeed. I thought that a static function could shadow a global function, but probably not with a different signature. Just out of
curiosity: what is the signature of wcwidth in your string.h?

Ciao,
Dscho

#3 lore raw
Quoted 3 lines · Johannes Schindelin

Thanks indeed. I thought that a static function could shadow a global function, but probably not with a different signature. Just out of
curiosity: what is the signature of wcwidth in your string.h?

This is it:

        extern int      wcwidth(wchar_t);