Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2461) bool type already exists
Home

[Freeciv-Dev] Re: (PR#2461) bool type already exists

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2461) bool type already exists
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 2 Dec 2002 10:37:07 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Sun, Dec 01, 2002 at 10:40:28AM -0800, Per I. Mathisen via RT wrote:
> 
> On Sun, 1 Dec 2002, Raimar Falke via RT wrote:
> > Please try the attached patch.
> 
> Not good enough for BeOS, since it seems to read its bool typedef from
> <posix/be_prim.h> for its posix layer. Including stdbool.h gives an
> error, just as if typedef'ing it ourselves.
> 
> So we may need to put
> 
> #if __BEOS__
> #include <posix/be_prim.h>
> #else
> ... everything else ...
> #endif
> 
> in there as well.
> 
> +#define TRUE true
> +#define FALSE false
> 
> Please undefine first to be on the safe side.

Changes of the new patch are listed above.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  A supercomputer is a computer running an endless loop in just a second

Index: configure.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.in,v
retrieving revision 1.205
diff -u -r1.205 configure.in
--- configure.in        2002/11/30 20:42:01     1.205
+++ configure.in        2002/12/02 18:25:52
@@ -547,7 +547,8 @@
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h)
+AC_CHECK_HEADERS(fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \
+                 stdbool.h)
 dnl Avoid including the unix emulation layer if we build mingw executables
 dnl There would be type conflicts between winsock and bsd/unix includes
 if test "x$MINGW32" != "xyes"; then
Index: common/shared.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v
retrieving revision 1.106
diff -u -r1.106 shared.h
--- common/shared.h     2002/11/21 13:35:31     1.106
+++ common/shared.h     2002/12/02 18:25:54
@@ -15,6 +15,24 @@
 
 #include <stdlib.h>            /* size_t */
 
+#if __BEOS__
+#include <posix/be_prim.h>
+#define __bool_true_false_are_defined 1
+#else
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#else /* Implement <stdbool.h> ourselves */
+#undef bool
+#undef true
+#undef false
+#undef __bool_true_false_are_defined
+#define bool fc_bool
+#define true  1
+#define false 0
+#define __bool_true_false_are_defined 1
+typedef unsigned int fc_bool;
+#endif /* ! HAVE_STDBOOL_H */
+#endif /* ! __BEOS__ */
 
 /* Want to use GCC's __attribute__ keyword to check variadic
  * parameters to printf-like functions, without upsetting other
@@ -47,14 +64,16 @@
    another unreachable condition. */
 #define FC_INFINITY            (1000 * 1000 * 1000)
 
-#ifndef TRUE
-#define TRUE (1)
+#ifdef TRUE
+#undef TRUE
 #endif
-#ifndef FALSE
-#define FALSE (0)
+
+#ifdef FALSE
+#undef FALSE
 #endif
 
-typedef int bool;
+#define TRUE true
+#define FALSE false
 
 #ifndef MAX
 #define MAX(x,y) (((x)>(y))?(x):(y))

[Prev in Thread] Current Thread [Next in Thread]