From 66455c3a66e6065cf4b0990b7177f77573158621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Thu, 3 Sep 2026 18:58:27 +0200 Subject: [PATCH 1/3] add -Wimplicit-fallthrough --- .github/workflows/werror.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/werror.yml b/.github/workflows/werror.yml index 21b4b6889..21855588c 100644 --- a/.github/workflows/werror.yml +++ b/.github/workflows/werror.yml @@ -8,7 +8,7 @@ on: env: _R_CHECK_FORCE_SUGGESTS_: "false" - RCPP_CXXFLAGS: "-Werror -Wcast-function-type -Wdeprecated-copy" + RCPP_CXXFLAGS: "-Werror -Wcast-function-type -Wdeprecated-copy -Wimplicit-fallthrough" jobs: ci: From cb14d618a2712e6b8307655a8cdf2a8724b43505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Thu, 3 Sep 2026 19:08:42 +0200 Subject: [PATCH 2/3] add explicit fallthrough comments --- inst/include/Rcpp/algo.h | 3 +++ inst/include/Rcpp/macros/unroll.h | 6 +++--- inst/include/Rcpp/vector/RangeIndexer.h | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/inst/include/Rcpp/algo.h b/inst/include/Rcpp/algo.h index c57cbf58d..603aa0d00 100644 --- a/inst/include/Rcpp/algo.h +++ b/inst/include/Rcpp/algo.h @@ -64,14 +64,17 @@ inline bool __any( RandomAccessIterator __first, RandomAccessIterator __last, co if (*__first == __val) return true; ++__first; + // fallthrough case 2: if (*__first == __val) return true; ++__first; + // fallthrough case 1: if (*__first == __val) return true; ++__first; + // fallthrough case 0: default: return false; diff --git a/inst/include/Rcpp/macros/unroll.h b/inst/include/Rcpp/macros/unroll.h index bd1e99d87..7e659af9a 100644 --- a/inst/include/Rcpp/macros/unroll.h +++ b/inst/include/Rcpp/macros/unroll.h @@ -33,11 +33,11 @@ for ( ; __trip_count > 0 ; --__trip_count) { \ } \ switch (n - i){ \ case 3: \ - *TARGET++ = SOURCE[i++] ; \ + *TARGET++ = SOURCE[i++] ; /* fallthrough */ \ case 2: \ - *TARGET++ = SOURCE[i++] ; \ + *TARGET++ = SOURCE[i++] ; /* fallthrough */ \ case 1: \ - *TARGET++ = SOURCE[i++] ; \ + *TARGET++ = SOURCE[i++] ; /* fallthrough */ \ case 0: \ default: \ {} \ diff --git a/inst/include/Rcpp/vector/RangeIndexer.h b/inst/include/Rcpp/vector/RangeIndexer.h index 967f5f35e..7e43e79fb 100644 --- a/inst/include/Rcpp/vector/RangeIndexer.h +++ b/inst/include/Rcpp/vector/RangeIndexer.h @@ -35,11 +35,11 @@ } \ switch (size_ - i){ \ case 3: \ - start[i] OP input[i] ; i++ ; \ + start[i] OP input[i] ; i++ ; /* fallthrough */ \ case 2: \ - start[i] OP input[i] ; i++ ; \ + start[i] OP input[i] ; i++ ; /* fallthrough */ \ case 1: \ - start[i] OP input[i] ; i++ ; \ + start[i] OP input[i] ; i++ ; /* fallthrough */ \ case 0: \ default: \ return *this ; \ From 798ccc1852c541e4e71b25e56e83789521c4b344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Thu, 3 Sep 2026 19:16:33 +0200 Subject: [PATCH 3/3] update ChangeLog --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 184ee89f8..495ad8b65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,13 @@ copy operator to avoid -Wdeprecated-copy warnings * inst/include/Rcpp/date_datetime/newDatetimeVector.h: Idem + * .github/workflows/werror.yaml: Add -Wimplicit-fallthrough + + * inst/include/Rcpp/algo.h: Add explicit fallthrough comments to avoid + -Wimplicit-fallthrough warnings + * inst/include/Rcpp/vector/RangeIndexer.h: Idem + * inst/include/Rcpp/macros/unroll.h: Idem + 2026-09-01 IƱaki Ucar * .github/workflows/werror.yaml: Add new CI file with -Werror enabled