This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

TRUE&FALSE conflicts on alpha*-dec-osf4.0d


sys/types.h defines TRUE and FALSE to 1 and 0, respectively, unless
they're already defined, causing programs that include
java/lang/Boolean.h after sys/types.h to fail to build.

This patch assumes that header files are well-behaved, in the sense
that they won't redefine TRUE and FALSE if they're already defined, if
they define them at all, or that they'll be included before
javaprims.h.  The first alternative is probably reasonable; I'm not
sure about the second, but I can't see any clean solution other than
special-casing java/lang/Boolean.h's TRUE and FALSE in gcjh,
#undefining them just before their declarations.  It's probably not
worth the trouble.

The choice of javaprims.h was arbitrary, it just seemed reasonable.

Here's the patch.  It hasn't caused any regressions on the targets
I've tested it ({Solaris,GNU/Linux}/{sparc,x86} and IRIX6.3/mips).

Index: libjava/ChangeLog
from  Alexandre Oliva  <oliva@dcc.unicamp.br>
	
	* include/javaprims.h (TRUE, FALSE): Redefine as themselves.
	
Index: libjava/include/javaprims.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/include/javaprims.h,v
retrieving revision 1.5
diff -u -r1.5 javaprims.h
--- libjava/include/javaprims.h	1999/05/18 15:32:55	1.5
+++ libjava/include/javaprims.h	1999/07/19 09:13:36
@@ -11,6 +11,11 @@
 #ifndef __JAVAPRIMS_H__
 #define __JAVAPRIMS_H__
 
+#undef TRUE
+#define TRUE TRUE
+#undef FALSE
+#define FALSE FALSE
+
 // To force selection of correct types that will mangle consistently
 // across platforms.
 extern "Java"

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]