From bb719a757ce81fb20dd52fba362f45c57fddec9b Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sat, 1 Jun 2024 08:31:47 -0500 Subject: [PATCH 1/3] Another 'clang++-17 -Wconversion -Wsign-conversion' --- ChangeLog | 5 +++++ inst/include/Rcpp/internal/Proxy_Iterator.h | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6c13fe62..de4d950c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-06-01 Dirk Eddelbuettel + + * inst/include/Rcpp/internal/Proxy_Iterator.h (Proxy_Iterator): + Switch to R_xlen_t ('clang++-17 -Wconversion -Wno-sign-conversion') + 2024-05-28 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version diff --git a/inst/include/Rcpp/internal/Proxy_Iterator.h b/inst/include/Rcpp/internal/Proxy_Iterator.h index bc94f112b..6ba891765 100644 --- a/inst/include/Rcpp/internal/Proxy_Iterator.h +++ b/inst/include/Rcpp/internal/Proxy_Iterator.h @@ -1,6 +1,4 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- -/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ -// + // Proxy_Iterator.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois @@ -31,7 +29,7 @@ class Proxy_Iterator { public: typedef PROXY& reference ; typedef PROXY* pointer ; - typedef int difference_type ; + typedef R_xlen_t difference_type ; typedef PROXY value_type; typedef std::random_access_iterator_tag iterator_category ; @@ -122,4 +120,3 @@ class Proxy_Iterator { } #endif - From 1a15629ec491a229331fcafc8de643ae5d1c3ae9 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sun, 2 Jun 2024 07:36:31 -0500 Subject: [PATCH 2/3] More 'clang++-17 -Wconversion -Wno-sign-conversion' changes --- ChangeLog | 8 ++++++++ inst/include/Rcpp/DataFrame.h | 2 +- inst/include/Rcpp/Vector.h | 3 +-- inst/include/Rcpp/internal/export.h | 7 +++---- inst/include/Rcpp/vector/SubMatrix.h | 17 ++++++++--------- inst/include/Rcpp/vector/Vector.h | 2 +- 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index de4d950c7..e46bdd3c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,15 @@ +2024-06-02 Dirk Eddelbuettel + + * inst/include/Rcpp/internal/export.h: More R_xlen_t switching + * inst/include/Rcpp/vector/SubMatrix.h: Idem + * inst/include/Rcpp/vector/Vector.h: Idem + 2024-06-01 Dirk Eddelbuettel * inst/include/Rcpp/internal/Proxy_Iterator.h (Proxy_Iterator): Switch to R_xlen_t ('clang++-17 -Wconversion -Wno-sign-conversion') + * inst/include/Rcpp/DataFrame.h: Idem + * inst/include/Rcpp/Vector.h: Idem 2024-05-28 Dirk Eddelbuettel diff --git a/inst/include/Rcpp/DataFrame.h b/inst/include/Rcpp/DataFrame.h index 053b159d3..0d03efcde 100644 --- a/inst/include/Rcpp/DataFrame.h +++ b/inst/include/Rcpp/DataFrame.h @@ -137,7 +137,7 @@ namespace Rcpp{ } void set_type_after_push(){ - int max_rows = 0; + R_xlen_t max_rows = 0; bool invalid_column_size = false; List::iterator it; // Get the maximum number of rows diff --git a/inst/include/Rcpp/Vector.h b/inst/include/Rcpp/Vector.h index e25be1d59..6c95ef8d9 100644 --- a/inst/include/Rcpp/Vector.h +++ b/inst/include/Rcpp/Vector.h @@ -1,5 +1,4 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- -// + // Vector.h: Rcpp R/C++ interface class library -- vectors // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois diff --git a/inst/include/Rcpp/internal/export.h b/inst/include/Rcpp/internal/export.h index e433127d7..0bcc77df7 100644 --- a/inst/include/Rcpp/internal/export.h +++ b/inst/include/Rcpp/internal/export.h @@ -1,6 +1,4 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- -/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ -// + // export.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois @@ -111,7 +109,8 @@ namespace Rcpp{ STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; R_xlen_t size = ::Rf_xlength(y) ; for( R_xlen_t i=0; i > { {} inline R_xlen_t size() const { return ((R_xlen_t)ncol()) * nrow() ; } - inline int ncol() const { return nc ; } - inline int nrow() const { return nr ; } + inline R_xlen_t ncol() const { return nc ; } + inline R_xlen_t nrow() const { return nr ; } inline Proxy operator()(int i, int j) const { return iter[ i + j*m_nr ] ; @@ -52,16 +51,16 @@ class SubMatrix : public Rcpp::MatrixBase< RTYPE, true, SubMatrix > { private: MATRIX& m ; vec_iterator iter ; - int m_nr, nc, nr ; + R_xlen_t m_nr, nc, nr ; } ; template class StoragePolicy > -Matrix::Matrix( const SubMatrix& sub ) : VECTOR( Rf_allocMatrix( RTYPE, sub.nrow(), sub.ncol() )), nrows(sub.nrow()) { - int nc = sub.ncol() ; +Matrix::Matrix( const SubMatrix& sub ) : VECTOR( Rf_allocMatrix( RTYPE, (int)sub.nrow(), (int)sub.ncol() )), nrows((int)sub.nrow()) { + R_xlen_t nc = sub.ncol() ; iterator start = VECTOR::begin() ; iterator rhs_it ; - for( int j=0; j Date: Sun, 2 Jun 2024 09:20:03 -0500 Subject: [PATCH 3/3] Revert a change --- inst/include/Rcpp/internal/export.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/inst/include/Rcpp/internal/export.h b/inst/include/Rcpp/internal/export.h index 0bcc77df7..46ce154c3 100644 --- a/inst/include/Rcpp/internal/export.h +++ b/inst/include/Rcpp/internal/export.h @@ -109,8 +109,7 @@ namespace Rcpp{ STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; R_xlen_t size = ::Rf_xlength(y) ; for( R_xlen_t i=0; i