Hi,

This patches addresses a problem with typedefs_md.h when trying to
compile for VxWorks. In this file we see definitions like these:

 #define _UINT32_T
 #ifndef uint32_t /* [sbb] scaffolding */
 typedef unsigned int uint32_t;
 #endif /* [sbb] scaffolding */


The problem with such a construct is when uint32_t isn't a macro, but a
real type that is defined with typedef. Then the compiler tries to
re-typedef this type which conflicts with the system type. My solution
here looks like this:

 #define _UINT32_T
 #if ! defined uint32_t && ! defined HAVE_UINT32_DEFINED
 typedef unsigned int uint32_t;
 #endif /* [sbb] scaffolding */

that is, we check the HAVE_UINT32_DEFINED. This has to be defined on a
target system where uint32_t is defined as type. In my setup I do this
in a configure-check, but OpenJDK doesn't use configure, so I left this
out. It should be possible to pass as compiler flag too. If this macro
isn't defined at all (the default) then the behaviour is exactly as
before.

Comments? Better solutions?

BTW: If this isn't the correct list, then please re-direct me to the
appropriate list.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: j2se/src/solaris/javavm/include/typedefs_md.h
===================================================================
--- j2se/src/solaris/javavm/include/typedefs_md.h	(Revision 254)
+++ j2se/src/solaris/javavm/include/typedefs_md.h	(Arbeitskopie)
@@ -70,7 +70,7 @@
 #endif	/* LONG_IS_64 */
 #endif /* don't HAVE_INTPTR_T */
 
-#ifndef	_UINT64_T
+#if ! defined _UINT64_T && ! defined HAVE_UINT64_DEFINED
 #define	_UINT64_T
 #ifdef LONG_IS_64
 typedef unsigned long uint64_t;
@@ -78,7 +78,7 @@
 typedef unsigned long long uint64_t;
 #endif
 #define _UINT32_T
-#ifndef uint32_t /* [sbb] scaffolding */
+#if ! defined uint32_t && ! defined HAVE_UINT32_DEFINED /* [sbb] scaffolding */
 typedef unsigned int uint32_t;
 #endif /* [sbb] scaffolding */
 #if defined(__linux__)
@@ -88,7 +88,7 @@
 
 #ifndef __BIT_TYPES_DEFINED__
 /* that should get Linux, at least */
-#ifndef	_INT64_T
+#if ! defined _INT64_T && ! defined HAVE_INT64_DEFINED
 #define	_INT64_T
 #ifdef LONG_IS_64
 typedef long int64_t;
@@ -96,7 +96,7 @@
 typedef long long int64_t;
 #endif
 #define _INT32_T
-#ifndef int32_t /* [sbb] scaffolding */
+#if ! defined int32_t && ! defined HAVE_INT32_DEFINED /* [sbb] scaffolding */
 typedef int int32_t;
 #endif /* [sbb] scaffolding */
 #if defined(__linux__)

Reply via email to