-
-
Notifications
You must be signed in to change notification settings - Fork 218
Description
Build-time feature detection does not seem to be an option here, but I'd like to suggest using a whitelist for backtrace() functionality rather than an ever-growing stoplist (e.g., #1338, #796):
Rcpp/inst/include/Rcpp/exceptions_impl.h
Lines 24 to 44 in 6570751
| // disable demangler on platforms where we have no support | |
| #ifndef RCPP_DEMANGLER_ENABLED | |
| # if defined(_WIN32) || \ | |
| defined(__FreeBSD__) || \ | |
| defined(__NetBSD__) || \ | |
| defined(__OpenBSD__) || \ | |
| defined(__DragonFly__) || \ | |
| defined(__CYGWIN__) || \ | |
| defined(__sun) || \ | |
| defined(_AIX) || \ | |
| defined(__MUSL__) || \ | |
| defined(__HAIKU__) || \ | |
| defined(__ANDROID__) | |
| # define RCPP_DEMANGLER_ENABLED 0 | |
| # elif defined(__GNUC__) || defined(__clang__) | |
| # include <execinfo.h> | |
| # define RCPP_DEMANGLER_ENABLED 1 | |
| # else | |
| # define RCPP_DEMANGLER_ENABLED 0 | |
| # endif | |
| #endif |
What brought me here is that the __MUSL__ exception (added long ago in #449) is an unreliable kludge as musl itself doesn't define such a macro (by design).
AFAICS, a suitable whitelist should be as simple as
defined(__GLIBC__) || defined(__APPLE__)where execinfo is built-in. The additional compiler check (gcc|clang) seems to be redundant (probably a relict). The suggested change is similar in spirit to the original commit in #449, which was discarded simply because it forgot to cover macOS. BSDs have long provided execinfo, too, but a web search suggests they require separate linking with -lexecinfo.