HenrikBengtsson / affxparser

🔬 R package: This is the Bioconductor devel version of the affxparser package.
http://bioconductor.org/packages/devel/bioc/html/affxparser.html
7 stars 3 forks source link

R CMD check WARNINGs: catching polymorphic type ‘class Except’ by value [-Wcatch-value=] #47

Closed HenrikBengtsson closed 1 year ago

HenrikBengtsson commented 1 year ago

Issue

Bioc devel check servers (http://bioconductor.org/checkResults/devel/bioc-LATEST/affxparser/nebbiolo1-checksrc.html) report on:

* using log directory ‘/home/biocbuild/bbs-3.17-bioc/meat/affxparser.Rcheck’
* using R Under development (unstable) (2023-03-16 r83996)
* using platform: x86_64-pc-linux-gnu (64-bit)
* R was compiled by
    gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
    GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
* running under: Ubuntu 22.04.2 LTS
...
* checking whether package ‘affxparser’ can be installed ... WARNING
Found the following significant warnings:
  ...
  R_affx_clf_pgf_parser.cpp:284:21: warning: catching polymorphic type ‘class Except’ by value [-Wcatch-value=]
  R_affx_clf_pgf_parser.cpp:327:21: warning: catching polymorphic type ‘class Except’ by value [-Wcatch-value=]
See ‘/home/biocbuild/bbs-3.17-bioc/meat/affxparser.Rcheck/00install.out’ for details.
* used C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
* used C++ compiler: ‘g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
...

There are more GCC warnings from the Fusion SDK code, but these are the ones from our C++ code.

Troubleshooting

More details from the installation logs:

R_affx_clf_pgf_parser.cpp: In function ‘SEXPREC* R_affx_get_clf_file(SEXP, SEXP, SEXP)’:
R_affx_clf_pgf_parser.cpp:284:21: warning: catching polymorphic type ‘class Except’ by value [-Wcatch-value=]
  284 |     } catch (Except ex) {
      |                     ^~
R_affx_clf_pgf_parser.cpp: In function ‘SEXPREC* R_affx_get_pgf_file(SEXP, SEXP, SEXP, SEXP)’:
R_affx_clf_pgf_parser.cpp:327:21: warning: catching polymorphic type ‘class Except’ by value [-Wcatch-value=]
  327 |     } catch (Except ex) {
      |    

I can reproduce this using R CMD check --as-cran on Ubuntu 22.04 with GCC 11.3.0, if and only if, I set ~/.R/Makevars to use:

CPPFLAGS=-I/usr/local/include -Wcatch-value

Actions

HenrikBengtsson commented 1 year ago

Just a note: I cannot reproduce these -Wcatch-value on GitHub Actions either (https://github.com/HenrikBengtsson/affxparser/actions/runs/4611016487/jobs/8150181899). The Bioc devel server runs an R version from 2023-03-16 (r83996), so it could be that this particular check has been pulled back from R again.

Anyway, since I can reproduce locally, I'll go ahead a fix the two instance in our own code. Since there are two instances of this issue in the Fusion SDK;

  fusion/file/TsvFile/TsvFile.cpp:4921:20: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
  fusion/file/TsvFile/TsvFile.cpp:4970:20: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]

we can watch and see if they disappear when Bioc devel updates to a new R version.

HenrikBengtsson commented 1 year ago

I'm confirming that these warnings has now disappeared from the Bioc-devel checks;


* using log directory ‘/home/biocbuild/bbs-3.17-bioc/meat/affxparser.Rcheck’
* using R version 4.3.0 alpha (2023-04-03 r84154)
* using platform: x86_64-pc-linux-gnu (64-bit)
* R was compiled by
    gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
    GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
* running under: Ubuntu 22.04.2 LTS
  fusion/file/CELFileData.cpp:3294:42: warning: taking address of packed member of ‘affxcel::_CELFileEntryType’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  fusion/file/TsvFile/TsvFile.cpp:4921:20: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
  fusion/file/TsvFile/TsvFile.cpp:4970:20: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
  fusion/util/AffxConv.cpp:124:15: warning: self-comparison always evaluates to false [-Wtautological-compare]
See ‘/home/biocbuild/bbs-3.17-bioc/meat/affxparser.Rcheck/00install.out’ for details.
* used C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
* used C++ compiler: ‘g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
...

This was with a recent R 4.3.0 alpha version. SInce these warnings are still there in the Fusion SDK code, it means that they are meant to stay