Description
I am developing an R package that uses JSON for Modern C++ (placed in src/include/json.hpp
and included with #include "include/json.hpp"
.) My issue is that devtools::check()
warns about pragma(s) suppressing important diagnostics:
── R CMD check results ──────────────────── cppheader 0.0.0.9000 ────
Duration: 8.1s
❯ checking pragmas in C/C++ headers and code ... WARNING
File which contains pragma(s) suppressing important diagnostics
‘src/include/json.hpp’
From what I can gather from Section 8 in R Internals, this is controlled by the environment variable _R_CHECK_PRAGMAS_
, which defaults to FALSE
for non-CRAN checks but TRUE
for CRAN checks.
I get the warning even though NOT_CRAN
is true
when testing locally. I also get the warning even when I explicitly set this environment variable to FALSE
, and also set NOT_CRAN
to true
, like so:
devtools::check(
document = TRUE,
env_vars = c(
"_R_CHECK_PRAGMAS_" = "FALSE",
"NOT_CRAN" = "true"
)
)
The environment variables are picked up, but I still get the warning:
══ Checking════════════════════════════════════════════════
Setting env vars:
• _R_CHECK_CRAN_INCOMING_REMOTE_ : FALSE
• _R_CHECK_CRAN_INCOMING_ : FALSE
• _R_CHECK_FORCE_SUGGESTS_ : FALSE
• _R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_: FALSE
• _R_CHECK_PRAGMAS_ : FALSE
• NOT_CRAN : true
...
── R CMD check results ──────────────────── cppheader 0.0.0.9000 ────
Duration: 8.3s
❯ checking pragmas in C/C++ headers and code ... WARNING
File which contains pragma(s) suppressing important diagnostics
‘src/include/json.hpp’
I raised this issue on Posit's forum, and was re-directed here; hope it's the right place.