Files
MINGW-packages/mingw-w64-pdcurses/003-fix-_bool-was-not-declared.patch
Liu Hao 6676dda82e pdcurses: Fix _bool is not declared error in C++.
Prior to this patch, C++ programs that include pdcurses headers hit this error:

  C:/MinGW/MSYS2/mingw64/include/pdcurses/curses.h:67:15: error: _bool was not declared in this scope; did you mean bool?
     67 | # define bool _bool
        |               ^~~~~

, which has been fixed by <8e41f71218/>.

Signed-off-by: Liu Hao <lh_mouse@126.com>
2019-06-13 22:03:24 +08:00

54 lines
1011 B
Diff

--- pdcurses-4.1.0.orig/curses.h 2019-05-09 07:27:41.000000000 +0800
+++ pdcurses-4.1.0/curses.h 2019-06-13 21:48:34.230201400 +0800
@@ -56,6 +56,10 @@
# include <wchar.h>
#endif
+#if defined(__cplusplus) && __cplusplus >= 199711L
+# define PDC_PP98 1
+#endif
+
#if defined(__STDC_VERSION__) && __STDC_VERSION >= 199901L && \
!defined(__bool_true_false_are_defined)
# include <stdbool.h>
@@ -64,7 +68,9 @@
#ifdef __cplusplus
extern "C"
{
-# define bool _bool
+# ifndef PDC_PP98
+# define bool _bool
+# endif
#endif
/*----------------------------------------------------------------------
@@ -83,13 +89,15 @@
#else
-typedef unsigned char bool;
-
# define FALSE 0
# define TRUE 1
#endif
+#if !defined(PDC_PP98) && !defined(__bool_true_false_are_defined)
+typedef unsigned char bool;
+#endif
+
#undef ERR
#define ERR (-1)
@@ -1840,7 +1848,9 @@
#define PDC_KEY_MODIFIER_REPEAT 16
#ifdef __cplusplus
-# undef bool
+# ifndef PDC_PP98
+# undef bool
+# endif
}
#endif