Skip to content

Commit

Permalink
revert the Rboolean changes pending further testing
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87679 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Feb 3, 2025
1 parent 0a76818 commit aec70cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
2 changes: 2 additions & 0 deletions doc/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@

The macro \code{_R_RBOOLEAN_IS_BOOL_} is defined where
\code{Rboolean} is implemented \emph{via} \code{bool}.

[Deferred pending further testing.]
}
}

Expand Down
42 changes: 6 additions & 36 deletions src/include/R_ext/Boolean.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 2000, 2025 The R Core Team.
* Copyright (C) 2000, 2001 The R Core Team.
*
* This header file is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -21,51 +21,21 @@
* https://www.R-project.org/Licenses/
*/

/* Included by R.h: Part of the API. */
/* Included by R.h: API */

#ifndef R_EXT_BOOLEAN_H_
#define R_EXT_BOOLEAN_H_

#undef FALSE
#undef TRUE



#ifdef __cplusplus

extern "C" {
/* once cpp11 is sorted
typedef bool Rboolean;
#define FALSE false
#define TRUE true
*/
typedef enum { FALSE = 0, TRUE } Rboolean;
}

# else

// Also include standard C boolean type
#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
// C23 so these are keywords
#else
// stdbool.h is C99, so available everywhere
//# include <stdbool.h>
#endif
typedef enum { FALSE = 0, TRUE /*, MAYBE */ } Rboolean;

/*
__bool_true_false_are_defined is defined in stdbool.h, and C23, but
it and stdbool.h are declared obsolescent in C23.
*/
#ifdef __bool_true_false_are_defined
typedef bool Rboolean;
# define FALSE false
# define TRUE true
# define _R_RBOOLEAN_IS_BOOL_ 1
#else
typedef enum { FALSE = 0, TRUE } Rboolean;
#endif //__bool_true_false_are_defined

# endif // __cplusplus

#ifdef __cplusplus
}
#endif

#endif /* R_EXT_BOOLEAN_H_ */

0 comments on commit aec70cc

Please sign in to comment.