Skip to content

Commit 1e61505

Browse files
committed
support -fno-rtti via define (closes #997)
1 parent 31e5d34 commit 1e61505

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2019-10-11 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/exceptions.h: Condition use of typeid() on
4+
absence of RCPP_NO_RTTI in two places
5+
* inst/include/Rcpp/r/headers.h: RCPP_NO_RTTI implied RCPP_NO_MODULES
6+
17
2019-10-04 Dirk Eddelbuettel <[email protected]>
28

39
* vignettes/Rcpp-attributes.Rmd: Correct two unevaluated knitr C++

inst/include/Rcpp/exceptions.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,11 @@ inline SEXP make_condition(const std::string& ex_msg, SEXP call, SEXP cppstack,
318318

319319
template <typename Exception>
320320
inline SEXP exception_to_condition_template( const Exception& ex, bool include_call) {
321+
#ifndef RCPP_NO_RTTI
321322
std::string ex_class = demangle( typeid(ex).name() ) ;
323+
#else
324+
std::string ex_class = "<not available>";
325+
#endif
322326
std::string ex_msg = ex.what() ;
323327

324328
Rcpp::Shelter<SEXP> shelter;
@@ -369,7 +373,10 @@ inline SEXP exception_to_try_error( const std::exception& ex){
369373
}
370374

371375
std::string demangle( const std::string& name) ;
376+
#ifndef RCPP_NO_RTTI
372377
#define DEMANGLE(__TYPE__) demangle( typeid(__TYPE__).name() ).c_str()
378+
#endif
379+
373380

374381
inline void forward_exception_to_r(const std::exception& ex){
375382
SEXP stop_sym = Rf_install( "stop" ) ;

inst/include/Rcpp/r/headers.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// headers.h: Rcpp R/C++ interface class library -- R headers
22
//
33
// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
4-
// Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
4+
// Copyright (C) 2009 - 2019 Dirk Eddelbuettel and Romain Francois
55
//
66
// This file is part of Rcpp.
77
//
@@ -26,6 +26,7 @@
2626
#define R_NO_REMAP
2727

2828
// until September 2019, define RCPP_NO_STRICT_R_HEADERS for transition
29+
// (that goal was too optimistic, reverse depency checks showed too much breakage)
2930
#ifndef RCPP_NO_STRICT_R_HEADERS
3031
# define RCPP_NO_STRICT_R_HEADERS
3132
#endif
@@ -36,6 +37,13 @@
3637
# endif
3738
#endif
3839

40+
// no rtti implies no modules
41+
#ifdef RCPP_NO_RTTI
42+
# ifndef RCPP_NO_MODULES
43+
# define RCPP_NO_MODULES
44+
# endif
45+
#endif
46+
3947
// prevent some macro pollution when including R headers
4048
// in particular, on Linux, gcc 'leaks' the 'major',
4149
// 'minor' and 'makedev' macros on Linux; we prevent

0 commit comments

Comments
 (0)