revamped the elfgcchack.h format to cope with gcc4 change of aliasing

* doc/apibuild.py doc/elfgcchack.xsl: revamped the elfgcchack.h
  format to cope with gcc4 change of aliasing allowed scopes, had
  to add extra informations to doc/libxml2-api.xml to separate
  the header from the c module source.
* *.c: updated all c library files to add a #define bottom_xxx
  and reimport elfgcchack.h thereafter, and a bit of cleanups.
* doc//* testapi.c: regenerated when rebuilding the API
Daniel
diff --git a/doc/elfgcchack.xsl b/doc/elfgcchack.xsl
index 5f5cb40..8f24aed 100644
--- a/doc/elfgcchack.xsl
+++ b/doc/elfgcchack.xsl
@@ -15,6 +15,12 @@
  * autogenerated with xsltproc doc/elfgcchack.xsl doc/libxml2-api.xml
  */
 
+#ifdef IN_LIBXML
+#ifdef __GNUC__
+#ifdef PIC
+#ifdef linux
+#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
+
 #include "libxml/c14n.h"
 #include "libxml/catalog.h"
 #include "libxml/chvalid.h"
@@ -64,18 +70,37 @@
 
 /* special hot spot not exported ones */
 
-extern __typeof (__xmlGenericError) __xmlGenericError__internal_alias __attribute((visibility("hidden")));
+#ifdef bottom_globals
+#undef __xmlGenericError
 extern __typeof (__xmlGenericError) __xmlGenericError __attribute((alias("__xmlGenericError__internal_alias")));
+#else
+#ifndef __xmlGenericError
+extern __typeof (__xmlGenericError) __xmlGenericError__internal_alias __attribute((visibility("hidden")));
 #define __xmlGenericError __xmlGenericError__internal_alias
+#endif
+#endif
 
-extern __typeof (__xmlGenericErrorContext) __xmlGenericErrorContext__internal_alias __attribute((visibility("hidden")));
+#ifdef bottom_globals
+#undef __xmlGenericErrorContext
 extern __typeof (__xmlGenericErrorContext) __xmlGenericErrorContext __attribute((alias("__xmlGenericErrorContext__internal_alias")));
+#else
+#ifndef __xmlGenericErrorContext
+extern __typeof (__xmlGenericErrorContext) __xmlGenericErrorContext__internal_alias __attribute((visibility("hidden")));
 #define __xmlGenericErrorContext __xmlGenericErrorContext__internal_alias
+#endif
+#endif
 
 /* list generated from libxml2-api.xml */
-
 </xsl:text>
     <xsl:apply-templates select="/api/symbols/function"/>
+    <xsl:text>
+#endif
+#endif
+#endif
+#endif
+#endif
+
+</xsl:text>
   </xsl:template>
 
   <xsl:template match="function">
@@ -83,25 +108,37 @@
     <xsl:if test="starts-with(@name, 'xml') or starts-with(@name, 'html') or contains(@name, 'Push') or contains(@name, 'Pop')">
       <xsl:variable name="alias" select="concat($str, '__internal_alias')"/>
       <xsl:apply-templates select="cond"/>
-      <xsl:text>extern __typeof (</xsl:text>
+      <xsl:text>#ifdef bottom_</xsl:text>
+      <xsl:value-of select="string(@module)"/>
+      <xsl:text>
+#undef </xsl:text>
       <xsl:value-of select="$str"/>
-      <xsl:text>) </xsl:text>
-      <xsl:value-of select="$alias"/>
-      <xsl:text> __attribute((visibility("hidden")));
-</xsl:text>
-      <xsl:text>extern __typeof (</xsl:text>
+      <xsl:text>
+extern __typeof (</xsl:text>
       <xsl:value-of select="$str"/>
       <xsl:text>) </xsl:text>
       <xsl:value-of select="$str"/>
       <xsl:text> __attribute((alias("</xsl:text>
       <xsl:value-of select="$alias"/>
       <xsl:text>")));
+#else
+#ifndef </xsl:text>
+      <xsl:value-of select="$str"/>
+      <xsl:text>
+</xsl:text>
+      <xsl:text>extern __typeof (</xsl:text>
+      <xsl:value-of select="$str"/>
+      <xsl:text>) </xsl:text>
+      <xsl:value-of select="$alias"/>
+      <xsl:text> __attribute((visibility("hidden")));
 </xsl:text>
       <xsl:text>#define </xsl:text>
       <xsl:value-of select="$str"/>
       <xsl:text> </xsl:text>
       <xsl:value-of select="$alias"/>
       <xsl:text>
+#endif
+#endif
 </xsl:text>
       <xsl:apply-templates select="cond" mode="end"/>
       <xsl:text>