Skip to content

Commit 9f07c76

Browse files
authored
simplify demangling checks (#1401)
1 parent 6570751 commit 9f07c76

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2025-10-21 Iñaki Ucar <[email protected]>
2+
3+
* inst/include/Rcpp/exceptions_impl.h: use __has_include to simplify checks
4+
to enable demangling, making them robust for more platforms
5+
16
2025-10-13 Dirk Eddelbuettel <[email protected]>
27

38
* DESCRIPTION (Version, Date): Roll micro version and date

inst/include/Rcpp/exceptions_impl.h

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// exceptions_impl.h: Rcpp R/C++ interface class library -- exceptions
22
//
33
// Copyright (C) 2012 - 2019 Dirk Eddelbuettel and Romain Francois
4-
// Copyright (C) 2020 Dirk Eddelbuettel, Romain Francois, and Joshua N. Pritikin
4+
// Copyright (C) 2020 - 2024 Dirk Eddelbuettel, Romain Francois, and Joshua N. Pritikin
5+
// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois, Joshua N. Pritikin, and Iñaki Ucar
56
//
67
// This file is part of Rcpp.
78
//
@@ -21,25 +22,15 @@
2122
#ifndef Rcpp__exceptions_impl__h
2223
#define Rcpp__exceptions_impl__h
2324

24-
// disable demangler on platforms where we have no support
25+
// enable demangler on platforms where execinfo.h is present
2526
#ifndef RCPP_DEMANGLER_ENABLED
26-
# if defined(_WIN32) || \
27-
defined(__FreeBSD__) || \
28-
defined(__NetBSD__) || \
29-
defined(__OpenBSD__) || \
30-
defined(__DragonFly__) || \
31-
defined(__CYGWIN__) || \
32-
defined(__sun) || \
33-
defined(_AIX) || \
34-
defined(__MUSL__) || \
35-
defined(__HAIKU__) || \
36-
defined(__ANDROID__)
37-
# define RCPP_DEMANGLER_ENABLED 0
38-
# elif defined(__GNUC__) || defined(__clang__)
39-
# include <execinfo.h>
40-
# define RCPP_DEMANGLER_ENABLED 1
41-
# else
42-
# define RCPP_DEMANGLER_ENABLED 0
27+
# define RCPP_DEMANGLER_ENABLED 0
28+
# if defined __has_include
29+
# if __has_include (<execinfo.h>)
30+
# include <execinfo.h>
31+
# undef RCPP_DEMANGLER_ENABLED
32+
# define RCPP_DEMANGLER_ENABLED 1
33+
# endif
4334
# endif
4435
#endif
4536

0 commit comments

Comments
 (0)