From 2f78e46f25bfa405cdf1b385179de04bfaffd906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Mon, 24 Mar 2025 18:03:43 +0100 Subject: [PATCH 1/4] remove macros for unordered maps/sets --- ChangeLog | 11 +++++++++++ inst/include/Rcpp/platform/compiler.h | 11 +++++++---- inst/include/Rcpp/sugar/functions/self_match.h | 5 +++-- inst/include/Rcpp/sugar/functions/setdiff.h | 11 ++++++----- inst/include/Rcpp/sugar/functions/table.h | 3 ++- inst/include/Rcpp/sugar/sets.h | 3 --- inst/tinytest/cpp/wrap.cpp | 17 +++++++++-------- 7 files changed, 38 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c3dedc2d..f2a87e723 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,17 @@ * inst/include/Rcpp/algorithm.h: Idem * inst/include/Rcpp/traits/is_arithmetic.h: Idem * inst/include/Rcpp/traits/longlong.h: Idem +2025-03-24 Iñaki Ucar + + * inst/include/Rcpp/platform/compiler.h: Remove definitions of + RCPP_USING_UNORDERED_MAP and RCPP_USING_UNORDERED_SET, deprecate macros + RCPP_UNORDERED_MAP and RCPP_UNORDERED_SET + * inst/include/Rcpp/sugar/sets.h: Remove redefinition of macros + * inst/include/Rcpp/sugar/functions/self_match.h: Replace macros with + std::unordered_map and std::unordered_set respectively + * inst/include/Rcpp/sugar/functions/setdiff.h: Idem + * inst/include/Rcpp/sugar/functions/table.h: Idem + * inst/tinytest/cpp/wrap.cpp: Idem 2025-03-21 Dirk Eddelbuettel diff --git a/inst/include/Rcpp/platform/compiler.h b/inst/include/Rcpp/platform/compiler.h index e3a38a20d..559fa8c68 100644 --- a/inst/include/Rcpp/platform/compiler.h +++ b/inst/include/Rcpp/platform/compiler.h @@ -1,6 +1,7 @@ // compiler.h: Rcpp R/C++ interface class library -- check compiler // // Copyright (C) 2012 - 2025 Dirk Eddelbuettel, Romain Francois, and Kevin Ushey +// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois, Kevin Ushey and Iñaki Ucar // // This file is part of Rcpp. // @@ -36,11 +37,13 @@ #include #include #include -#define RCPP_USING_UNORDERED_MAP -#define RCPP_UNORDERED_MAP std::unordered_map +#define RCPP_UNORDERED_MAP \ + _Pragma("GCC warning \"RCPP_UNORDERED_MAP is deprecated, use std::unordered_map instead\"") \ + std::unordered_map #include -#define RCPP_USING_UNORDERED_SET -#define RCPP_UNORDERED_SET std::unordered_set +#define RCPP_UNORDERED_SET \ + _Pragma("GCC warning \"RCPP_UNORDERED_SET is deprecated, use std::unordered_set instead\"") \ + std::unordered_set #if defined(__GNUC__) #define RCPP_HAS_DEMANGLING diff --git a/inst/include/Rcpp/sugar/functions/self_match.h b/inst/include/Rcpp/sugar/functions/self_match.h index 67dd36cf4..d71aacf94 100644 --- a/inst/include/Rcpp/sugar/functions/self_match.h +++ b/inst/include/Rcpp/sugar/functions/self_match.h @@ -2,7 +2,8 @@ // // self_match.h: Rcpp R/C++ interface class library -- self match // -// Copyright (C) 2012 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2012 - 2024 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar // // This file is part of Rcpp. // @@ -57,7 +58,7 @@ class SelfMatch { inline operator IntegerVector() const { return result ; } private: - typedef RCPP_UNORDERED_MAP HASH ; + typedef std::unordered_map HASH ; typedef SelfInserter Inserter ; HASH hash ; IntegerVector result ; diff --git a/inst/include/Rcpp/sugar/functions/setdiff.h b/inst/include/Rcpp/sugar/functions/setdiff.h index fecc7c6cf..d2886ae5f 100644 --- a/inst/include/Rcpp/sugar/functions/setdiff.h +++ b/inst/include/Rcpp/sugar/functions/setdiff.h @@ -2,7 +2,8 @@ // // setdiff.h: Rcpp R/C++ interface class library -- setdiff // -// Copyright (C) 2012 - 2014 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2012 - 2024 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar // // This file is part of Rcpp. // @@ -60,7 +61,7 @@ namespace sugar{ } private: - typedef RCPP_UNORDERED_SET SET ; + typedef std::unordered_set SET ; typedef typename SET::const_iterator ITERATOR ; SET lhs_set ; SET rhs_set ; @@ -89,7 +90,7 @@ namespace sugar{ } private: - typedef RCPP_UNORDERED_SET SET ; + typedef std::unordered_set SET ; typedef typename SET::const_iterator ITERATOR ; SET lhs_set ; SET rhs_set ; @@ -123,7 +124,7 @@ namespace sugar{ } private: - typedef RCPP_UNORDERED_SET SET ; + typedef std::unordered_set SET ; typedef typename SET::const_iterator ITERATOR ; SET intersect ; @@ -148,7 +149,7 @@ namespace sugar{ } private: - typedef RCPP_UNORDERED_SET SET ; + typedef std::unordered_set SET ; typedef typename SET::const_iterator ITERATOR ; SET result ; diff --git a/inst/include/Rcpp/sugar/functions/table.h b/inst/include/Rcpp/sugar/functions/table.h index 74cb01b20..bc3d8074a 100644 --- a/inst/include/Rcpp/sugar/functions/table.h +++ b/inst/include/Rcpp/sugar/functions/table.h @@ -1,6 +1,7 @@ // table.h: Rcpp R/C++ interface class library -- table match // // Copyright (C) 2012 - 2025 Dirk Eddelbuettel, Romain Francois, and Kevin Ushey +// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois, Kevin Ushey and Iñaki Ucar // // This file is part of Rcpp. // @@ -77,7 +78,7 @@ class Table { } private: - typedef RCPP_UNORDERED_MAP HASH ; + typedef std::unordered_map HASH ; typedef CountInserter Inserter ; HASH hash ; diff --git a/inst/include/Rcpp/sugar/sets.h b/inst/include/Rcpp/sugar/sets.h index e1aaaec2e..402886cd1 100644 --- a/inst/include/Rcpp/sugar/sets.h +++ b/inst/include/Rcpp/sugar/sets.h @@ -20,9 +20,6 @@ #ifndef Rcpp__sugar__sets_h #define Rcpp__sugar__sets_h -#define RCPP_UNORDERED_SET std::unordered_set -#define RCPP_UNORDERED_MAP std::unordered_map - namespace std { template<> struct hash { diff --git a/inst/tinytest/cpp/wrap.cpp b/inst/tinytest/cpp/wrap.cpp index 1abcd00ea..eefd5c2d9 100644 --- a/inst/tinytest/cpp/wrap.cpp +++ b/inst/tinytest/cpp/wrap.cpp @@ -3,6 +3,7 @@ // wrap.cpp: Rcpp R/C++ interface class library -- wrap unit tests // // Copyright (C) 2013 - 2025 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar // // This file is part of Rcpp. // @@ -170,7 +171,7 @@ SEXP nonnull_const_char(){ // [[Rcpp::export]] IntegerVector unordered_map_string_int(){ - RCPP_UNORDERED_MAP< std::string, int > m ; + std::unordered_map< std::string, int > m ; m["b"] = 100; m["a"] = 200; m["c"] = 300; @@ -179,7 +180,7 @@ IntegerVector unordered_map_string_int(){ // [[Rcpp::export]] IntegerVector unordered_map_rcpp_string_int(StringVector v){ - RCPP_UNORDERED_MAP< String, int > m ; + std::unordered_map< String, int > m ; m[v[0]] = 200; m[v[1]] = 100; m[v[2]] = 300; @@ -188,7 +189,7 @@ IntegerVector unordered_map_rcpp_string_int(StringVector v){ // [[Rcpp::export]] LogicalVector unordered_set_rcpp_string(StringVector x) { - RCPP_UNORDERED_SET seen; + std::unordered_set seen; LogicalVector out(x.size()); for (int i = 0; i < x.size(); i++) { out[i] = !seen.insert(x[i]).second; @@ -198,7 +199,7 @@ LogicalVector unordered_set_rcpp_string(StringVector x) { // [[Rcpp::export]] NumericVector unordered_map_string_double(){ - RCPP_UNORDERED_MAP m ; + std::unordered_map m ; m["b"] = 100; m["a"] = 200; m["c"] = 300; @@ -207,7 +208,7 @@ NumericVector unordered_map_string_double(){ // [[Rcpp::export]] LogicalVector unordered_map_string_bool(){ - RCPP_UNORDERED_MAP m ; + std::unordered_map m ; m["b"] = true; m["a"] = false; m["c"] = true; @@ -216,7 +217,7 @@ LogicalVector unordered_map_string_bool(){ // [[Rcpp::export]] RawVector unordered_map_string_Rbyte(){ - RCPP_UNORDERED_MAP m ; + std::unordered_map m ; m["b"] = (Rbyte)0; m["a"] = (Rbyte)1; m["c"] = (Rbyte)2; @@ -225,7 +226,7 @@ RawVector unordered_map_string_Rbyte(){ // [[Rcpp::export]] CharacterVector unordered_map_string_string(){ - RCPP_UNORDERED_MAP m ; + std::unordered_map m ; m["b"] = "foo" ; m["a"] = "bar" ; m["c"] = "bling" ; @@ -234,7 +235,7 @@ CharacterVector unordered_map_string_string(){ // [[Rcpp::export]] List unordered_map_string_generic(){ - RCPP_UNORDERED_MAP< std::string,std::vector > m ; + std::unordered_map< std::string,std::vector > m ; std::vector b; b.push_back(1); b.push_back(2); m["b"] = b ; std::vector a; a.push_back(1); a.push_back(2); a.push_back(2); m["a"] = a; std::vector c; c.push_back(1); c.push_back(2); c.push_back(2); c.push_back(2); m["c"] = c; From 47db39e11991a6f456b521dd379de2b50e5cbfa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Mon, 24 Mar 2025 18:23:56 +0100 Subject: [PATCH 2/4] do not deprecate yet --- ChangeLog | 3 +-- inst/include/Rcpp/platform/compiler.h | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2a87e723..3c12c17d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,8 +27,7 @@ 2025-03-24 Iñaki Ucar * inst/include/Rcpp/platform/compiler.h: Remove definitions of - RCPP_USING_UNORDERED_MAP and RCPP_USING_UNORDERED_SET, deprecate macros - RCPP_UNORDERED_MAP and RCPP_UNORDERED_SET + RCPP_USING_UNORDERED_MAP and RCPP_USING_UNORDERED_SET * inst/include/Rcpp/sugar/sets.h: Remove redefinition of macros * inst/include/Rcpp/sugar/functions/self_match.h: Replace macros with std::unordered_map and std::unordered_set respectively diff --git a/inst/include/Rcpp/platform/compiler.h b/inst/include/Rcpp/platform/compiler.h index 559fa8c68..3f75161b2 100644 --- a/inst/include/Rcpp/platform/compiler.h +++ b/inst/include/Rcpp/platform/compiler.h @@ -37,13 +37,9 @@ #include #include #include -#define RCPP_UNORDERED_MAP \ - _Pragma("GCC warning \"RCPP_UNORDERED_MAP is deprecated, use std::unordered_map instead\"") \ - std::unordered_map +#define RCPP_UNORDERED_MAP std::unordered_map // TODO deprecate #include -#define RCPP_UNORDERED_SET \ - _Pragma("GCC warning \"RCPP_UNORDERED_SET is deprecated, use std::unordered_set instead\"") \ - std::unordered_set +#define RCPP_UNORDERED_SET std::unordered_set // TODO deprecate #if defined(__GNUC__) #define RCPP_HAS_DEMANGLING From dca5edbc1939693ee0ef85cfd3aa7e114c2b50e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Wed, 26 Mar 2025 20:26:38 +0100 Subject: [PATCH 3/4] update Changelog --- ChangeLog | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c12c17d6..921b4cf07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2025-03-26 Iñaki Ucar + + * inst/include/Rcpp/platform/compiler.h: Remove definitions of + RCPP_USING_UNORDERED_MAP and RCPP_USING_UNORDERED_SET + * inst/include/Rcpp/sugar/sets.h: Remove redefinition of macros + * inst/include/Rcpp/sugar/functions/self_match.h: Replace macros with + std::unordered_map and std::unordered_set respectively + * inst/include/Rcpp/sugar/functions/setdiff.h: Idem + * inst/include/Rcpp/sugar/functions/table.h: Idem + * inst/tinytest/cpp/wrap.cpp: Idem + 2025-03-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date @@ -24,16 +35,6 @@ * inst/include/Rcpp/algorithm.h: Idem * inst/include/Rcpp/traits/is_arithmetic.h: Idem * inst/include/Rcpp/traits/longlong.h: Idem -2025-03-24 Iñaki Ucar - - * inst/include/Rcpp/platform/compiler.h: Remove definitions of - RCPP_USING_UNORDERED_MAP and RCPP_USING_UNORDERED_SET - * inst/include/Rcpp/sugar/sets.h: Remove redefinition of macros - * inst/include/Rcpp/sugar/functions/self_match.h: Replace macros with - std::unordered_map and std::unordered_set respectively - * inst/include/Rcpp/sugar/functions/setdiff.h: Idem - * inst/include/Rcpp/sugar/functions/table.h: Idem - * inst/tinytest/cpp/wrap.cpp: Idem 2025-03-21 Dirk Eddelbuettel From 71b01bbdbc08ed615912ea45bee0b5d7761e2e1d Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Wed, 26 Mar 2025 14:57:14 -0500 Subject: [PATCH 4/4] Roll micro version and date Used by #1372 --- ChangeLog | 5 +++++ DESCRIPTION | 4 ++-- inst/include/Rcpp/config.h | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 921b4cf07..b9173cb08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-03-26 Dirk Eddelbuettel + + * DESCRIPTION (Version, Date): Roll micro version and date + * inst/include/Rcpp/config.h: Idem + 2025-03-26 Iñaki Ucar * inst/include/Rcpp/platform/compiler.h: Remove definitions of diff --git a/DESCRIPTION b/DESCRIPTION index 26e85ec1b..e7b82b50c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: Rcpp Title: Seamless R and C++ Integration -Version: 1.0.14.10 -Date: 2025-03-24 +Version: 1.0.14.11 +Date: 2025-03-26 Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org", comment = c(ORCID = "0000-0001-6419-907X")), person("Romain", "Francois", role = "aut", diff --git a/inst/include/Rcpp/config.h b/inst/include/Rcpp/config.h index a54ea8d34..9c96f6999 100644 --- a/inst/include/Rcpp/config.h +++ b/inst/include/Rcpp/config.h @@ -30,7 +30,7 @@ #define RCPP_VERSION_STRING "1.0.14" // the current source snapshot (using four components, if a fifth is used in DESCRIPTION we ignore it) -#define RCPP_DEV_VERSION RcppDevVersion(1,0,14,10) -#define RCPP_DEV_VERSION_STRING "1.0.14.10" +#define RCPP_DEV_VERSION RcppDevVersion(1,0,14,11) +#define RCPP_DEV_VERSION_STRING "1.0.14.11" #endif