From 8e41f712184156fa4e0966c0c9b3b3fe0dc990be Mon Sep 17 00:00:00 2001 From: William McBrine Date: Wed, 20 Feb 2019 11:41:15 -0500 Subject: [PATCH] Check for standard C++ (>= 98), where native bool should exist, and use that; otherwise (pre-/non-standard C++) fall back to the old behavior. Satisfies clang, hopefully doesn't mess anything else up. --- curses.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/curses.h b/curses.h index c7f3e22f..8251ec51 100644 --- a/curses.h +++ b/curses.h @@ -28,7 +28,7 @@ Defined by this header: **man-end****************************************************************/ #define PDCURSES 1 /* PDCurses-only routines */ -#define PDC_BUILD 3801 +#define PDC_BUILD 3802 #define PDC_VER_MAJOR 3 #define PDC_VER_MINOR 8 #define PDC_VERDOT "3.8" @@ -38,6 +38,10 @@ Defined by this header: # define PDC_99 1 #endif +#if defined(__cplusplus) && __cplusplus >= 199711L +# define PDC_PP98 1 +#endif + /*----------------------------------------------------------------------*/ #include @@ -55,7 +59,9 @@ Defined by this header: #ifdef __cplusplus extern "C" { -# define bool _bool +# ifndef PDC_PP98 +# define bool _bool +# endif #endif /*---------------------------------------------------------------------- @@ -76,7 +82,7 @@ extern "C" #undef OK #define OK 0 -#ifndef __bool_true_false_are_defined +#if !defined(PDC_PP98) && !defined(__bool_true_false_are_defined) typedef unsigned char bool; #endif @@ -1368,7 +1374,9 @@ PDCEX int sb_refresh(void); #define PDC_KEY_MODIFIER_NUMLOCK 8 #ifdef __cplusplus -# undef bool +# ifndef PDC_PP98 +# undef bool +# endif } #endif