some gcc4 portability patches, including a serious aliasing bug exposed in

* include/libxml/hash.h libxml.h libxml.spec.in: some gcc4 portability
  patches, including a serious aliasing bug exposed in s390
  when trying to convert data pointer to code pointer.
Daniel
diff --git a/ChangeLog b/ChangeLog
index efa9ab6..2219c98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Mar 10 10:20:23 CET 2005 Daniel Veillard <daniel@veillard.com>
+
+	* include/libxml/hash.h libxml.h libxml.spec.in: some gcc4 portability
+	  patches, including a serious aliasing bug exposed in s390 
+	  when trying to convert data pointer to code pointer.
+
 Mon Mar  7 18:34:00 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
 
 	* xmlschemas.c: Tiny restructuring of the validation start-up
diff --git a/include/libxml/hash.h b/include/libxml/hash.h
index efc29a7..7fe4be7 100644
--- a/include/libxml/hash.h
+++ b/include/libxml/hash.h
@@ -48,8 +48,13 @@
  * function pointer without encountering a warning from
  * gcc
  *
+ * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
+ * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
+ * so it is disabled now
  */
-#define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
+
+#define XML_CAST_FPTR(fptr) fptr
+
 
 /*
  * function types:
diff --git a/libxml.h b/libxml.h
index e997462..89ec595 100644
--- a/libxml.h
+++ b/libxml.h
@@ -54,9 +54,11 @@
 #ifdef __GNUC__
 #ifdef PIC
 #ifdef linux
+#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
 #include "elfgcchack.h"
 #endif
 #endif
 #endif
 #endif
+#endif
 #endif /* ! __XML_LIBXML_H__ */
diff --git a/libxml.spec.in b/libxml.spec.in
index f9823df..b4f3761 100644
--- a/libxml.spec.in
+++ b/libxml.spec.in
@@ -65,22 +65,11 @@
 # initial test spec. This really doesn't work okay for most tests done.
 #
 GCC_VERSION=`gcc --version | grep "^gcc" | awk '{ print $3 }' | sed 's+\([0-9]\)\.\([0-9]\)\..*+\1\2+'`
-#if [ $GCC_VERSION -eq 32 ]
-#then
-#    PROF_GEN='-fprofile-arcs'
-#    PROF_USE='-fbranch-probabilities'
-#else if [ $GCC_VERSION -eq 33 ]
-#then
-#    PROF_GEN='-fprofile-arcs'
-#    PROF_USE='-fbranch-probabilities -ftracer'
-#else
-if [ $GCC_VERSION -ge 34 ]
+if [ $GCC_VERSION -eq 34 ]
 then
     PROF_GEN='-fprofile-generate'
     PROF_USE='-fprofile-use'
 fi
-#fi
-#fi
 
 if [ "$PROF_GEN" != "" ]
 then