From f33a46a28dfce4f63ae7f4e812a0e6ce318d342e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Tue, 21 Oct 2025 10:26:47 +0200 Subject: [PATCH] simplify demangling checks --- ChangeLog | 5 +++++ inst/include/Rcpp/exceptions_impl.h | 29 ++++++++++------------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c0b68f83..537e17186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-10-21 Iñaki Ucar + + * inst/include/Rcpp/exceptions_impl.h: use __has_include to simplify checks + to enable demangling, making them robust for more platforms + 2025-10-13 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date diff --git a/inst/include/Rcpp/exceptions_impl.h b/inst/include/Rcpp/exceptions_impl.h index 4cfecdfbb..a3e7abdc1 100644 --- a/inst/include/Rcpp/exceptions_impl.h +++ b/inst/include/Rcpp/exceptions_impl.h @@ -1,7 +1,8 @@ // exceptions_impl.h: Rcpp R/C++ interface class library -- exceptions // // Copyright (C) 2012 - 2019 Dirk Eddelbuettel and Romain Francois -// Copyright (C) 2020 Dirk Eddelbuettel, Romain Francois, and Joshua N. Pritikin +// Copyright (C) 2020 - 2024 Dirk Eddelbuettel, Romain Francois, and Joshua N. Pritikin +// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois, Joshua N. Pritikin, and Iñaki Ucar // // This file is part of Rcpp. // @@ -21,25 +22,15 @@ #ifndef Rcpp__exceptions_impl__h #define Rcpp__exceptions_impl__h -// disable demangler on platforms where we have no support +// enable demangler on platforms where execinfo.h is present #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 -# define RCPP_DEMANGLER_ENABLED 1 -# else -# define RCPP_DEMANGLER_ENABLED 0 +# define RCPP_DEMANGLER_ENABLED 0 +# if defined __has_include +# if __has_include () +# include +# undef RCPP_DEMANGLER_ENABLED +# define RCPP_DEMANGLER_ENABLED 1 +# endif # endif #endif