removing compiler warnings by making the interface accept pointers#672
removing compiler warnings by making the interface accept pointers#672
Conversation
|
📄 Documentation for this branch is available at: https://ncar.github.io/musica/branch/166-refactor-utils-api-to-clean-up-warnings/ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #672 +/- ##
==========================================
+ Coverage 76.93% 78.26% +1.32%
==========================================
Files 54 54
Lines 7259 7192 -67
==========================================
+ Hits 5585 5629 +44
+ Misses 1674 1563 -111 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the C/C++ interface to eliminate compiler warnings by changing functions that return stack-allocated variables to void functions that accept pointer parameters instead. The changes affect error handling, string creation, mapping construction, and several TUV-x interface functions.
Key Changes:
- Modified
CreateString,NoError,ToError, andToMappingfunctions to accept output pointers instead of returning values - Updated TUV-x ordering functions (
GetPhotolysisRateConstantsOrdering,GetHeatingRatesOrdering,GetDoseRatesOrdering) to accept output parameters - Updated Fortran interfaces to match the new C function signatures
- Modified all call sites throughout the codebase to use the new interfaces
- Updated test cases to reflect the new function signatures
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/util.cpp | Refactored utility functions to accept output pointers |
| src/tuvx/tuvx_c_interface.cpp | Updated TUV-x C interface functions to match new signatures |
| src/tuvx/tuvx.cpp | Modified TUV-x class methods to use new error/string interfaces |
| src/tuvx/radiator_map.cpp | Updated error handling to use pointer-based functions |
| src/tuvx/radiator.cpp | Updated error handling to use pointer-based functions |
| src/tuvx/profile_map.cpp | Updated error handling to use pointer-based functions |
| src/tuvx/profile.cpp | Updated error handling and string retrieval to use pointers |
| src/tuvx/grid_map.cpp | Updated error handling to use pointer-based functions |
| src/tuvx/grid.cpp | Updated error handling and string retrieval to use pointers |
| src/tuvx/interface_util.F90 | Changed Fortran interface for CreateString from function to subroutine |
| src/tuvx/interface_profile.F90 | Changed Fortran interfaces for string getters from functions to subroutines |
| src/tuvx/interface_grid.F90 | Changed Fortran interfaces for string getters from functions to subroutines |
| src/tuvx/interface.F90 | Changed TUV-x ordering functions from functions to subroutines |
| fortran/util.F90 | Updated Fortran wrapper to use new CreateString signature |
| fortran/tuvx/tuvx.F90 | Updated Fortran wrapper to use new ordering function signatures |
| src/test/unit/*.cpp | Updated test code to use new function signatures |
| include/musica/*.hpp | Updated header files with new function signatures |
| src/micm/*.cpp | Updated MICM code to use new error/string interfaces |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closes #166
Any interface that was returning a stack variable previously now returns void and accepts a pointer instead