libsbml icon indicating copy to clipboard operation
libsbml copied to clipboard

add printf style formatting to Rf_error calls

Open spotaws opened this issue 9 months ago • 0 comments

Description

This change adds prinf style formatting to Rf_error calls. Without this, compilation fails when -Wformat-security is passed to gcc.

/home/spot/git/libsbml/libsbml-5.20.2/build/src/bindings/r/libsbml_wrap.cpp:330601:17: error: format not a string literal and no format arguments [-Werror=format-security]
330601 |         Rf_error(e.what());
       |         ~~~~~~~~^~~~~~~~~~

I have tested this in Fedora 41 (Rawhide) against gcc-14.0.1 and R 4.4.0 and it resolves the "Fails To Build From Source" issue.

Motivation and Context

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Change in documentation

Checklist:

  • [x] I have updated all documentation necessary.
  • [x] I have checked spelling in (new) comments.

Testing

  • [X] Testing is done automatically and codecov shows test coverage
  • [ ] This cannot be tested automatically

spotaws avatar May 19 '24 20:05 spotaws