This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: TRUE / FALSE redefinition in gcj/javaprims.h
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: toa at pop dot agri dot ch (Andreas Tobler)
- Cc: java at gcc dot gnu dot org, tromey at redhat dot com, ro at TechFak dot Uni-Bielefeld dot DE, aoliva at redhat dot com
- Date: Sun, 21 May 2006 18:28:50 -0400 (EDT)
- Subject: Re: TRUE / FALSE redefinition in gcj/javaprims.h
> we have a problem with the following _HACK_ in gcj/javaprims.h:
>
> // FIXME: this is a hack until we get a proper gcjh.
> // It is needed to work around system header files that define TRUE
> // and FALSE.
> #undef TRUE
> #define TRUE TRUE
> #undef FALSE
> #define FALSE FALSE
>
> The ChangeLog entry dates back to:
>
> 1999-08-12 Alexandre Oliva <oliva@dcc.unicamp.br>
>
> * include/javaprims.h (TRUE, FALSE): Redefine as themselves.
I'm trying the enclosed fix which I think will work around the
problem. It's the following that interacts badly with the defines
in gcj/javaprims.h.
/*
* For source compatibility, need to continue defining TRUE and FALSE for
* user-level applications. Although this file defines a kernel only service,
* some user-level applications are indirectly including this file and
* depending on the defines for TRUE and FALSE. These defines need to
* remain until all the user-level issues have been handled.
*/
#ifndef _KERNEL
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#else
#if ((TRUE != 1) || (FALSE != 0))
This is probably not a good thing....
#endif
#endif /* !TRUE */
#endif /* !_KERNEL */
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
Index: configure.ac
===================================================================
--- configure.ac (revision 113941)
+++ configure.ac (working copy)
@@ -1276,7 +1276,7 @@
sys/ioctl.h sys/filio.h sys/stat.h sys/select.h \
sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h \
pwd.h sys/config.h stdint.h langinfo.h locale.h \
- dirent.h])
+ dirent.h sys/rw_lock.h])
AC_CHECK_HEADERS(inttypes.h, [
AC_DEFINE(HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
AC_DEFINE(JV_HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
Index: include/posix.h
===================================================================
--- include/posix.h (revision 113941)
+++ include/posix.h (working copy)
@@ -37,6 +37,12 @@
#include <fcntl.h>
+/* The header file <sys/rw_lock.h> needs to be included before javaprims.h
+ on HP-UX 11 to avoid a compilation error. */
+#ifdef HAVE_SYS_RW_LOCK_H
+#include <sys/rw_lock.h>
+#endif
+
#include <gcj/cni.h>
#include <java/util/Properties.h>