[Rd] R-devel, bool, and C23

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Sat Mar 15 13:51:11 CET 2025


On 15 March 2025 at 09:49, Ivan Krylov wrote:
| On Fri, 14 Mar 2025 22:25:54 -0500
| Dirk Eddelbuettel <edd using debian.org> wrote:
| 
| > An older package I looked at apparently currently fails to build under
| > r-devel (and with that my thanks to R-universe for giving us a
| > 'broad' range of builds for free -- off our development sources) over
| > 'bool' related changes and enum definitions.
| > 
| > I can get it to behave and build by declaring
| > 
| >   PKG_CFLAGS = -std=gnu23
| 
| Could you please share the compilation failure messages? The -std=gnu23
| flag causes R_ext/Boolean.h to _not_ #include <stdbool.h> before
| defining enum Rboolean, so the problem is likely related to that.

Sure thing. It is as so often a C++ package but has one C file src/init.c
which begins with

  #include <R.h>
  #include <Rinternals.h>
  #include <stdlib.h> // for NULL
  #include <R_ext/Rdynload.h>

and compilation then fails with

  In file included from /usr/local/lib/R-devel/lib/R/include/R.h:70,
                   from init.c:1:
  /usr/local/lib/R-devel/lib/R/include/R_ext/Boolean.h:62:16: warning: ISO C does not support specifying ‘enum’ underlying types before C23 [-Wpedantic]
     62 |   typedef enum :int { FALSE = 0, TRUE } Rboolean;  // so NOT NA
        |                ^

so apparently R.h as it is upsets it.

Cheers, Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-devel mailing list