NOAA-FIMS / FIMS

The repository for development of FIMS
https://noaa-fims.github.io/FIMS/
GNU General Public License v3.0
12 stars 8 forks source link

[Developer Issue]: warnings in run-clang-tidy github action #429

Open k-doering-NOAA opened 11 months ago

k-doering-NOAA commented 11 months ago

Issue details

I realized there are a few warnings in the run-clang-tidy job on the main branch that suggest cleaning up a few minor things in fims. I think they are all of a similar form:

warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
  ret = vsnprintf(buff_ptr.get(), size, msg, args);
  ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/FIMS/_build/_deps/googlebenchmark-src/src/string_util.cc:154:3: note: Value stored to 'ret' is never read
  ret = vsnprintf(buff_ptr.get(), size, msg, args);
  ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Look in the run step to see all of the warnings.

msupernaw commented 11 months ago

These warnings aren't from FIMS, it looks like they are part of googlebenchmark-src.

On Wed, Aug 2, 2023 at 8:23 AM Kathryn Doering @.***> wrote:

Issue details

I realized there are a few warnings in the run-clang-tidy job on the main branch https://github.com/NOAA-FIMS/FIMS/actions/runs/5683723130/job/15404871188 that suggest cleaning up a few minor things in fims. I think they are all of a similar form:

warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores] ret = vsnprintf(buff_ptr.get(), size, msg, args); ^ ~~~~~~~~~~ /home/runner/work/FIMS/_build/_deps/googlebenchmark-src/src/string_util.cc:154:3: note: Value stored to 'ret' is never read ret = vsnprintf(buff_ptr.get(), size, msg, args); ^ ~~~~~~~~~~

Look in the run step to see all of the warnings.

— Reply to this email directly, view it on GitHub https://github.com/NOAA-FIMS/FIMS/issues/429, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFUSEEXCSRGEO7ZQN27JDTXTJBEJANCNFSM6AAAAAA3BGBBPM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Matthew Supernaw Scientific Software Developer National Oceanic and Atmospheric Administration Office Of Science and Technology NOAA Fisheries | U.S. Department of Commerce Phone 248 - 396 - 7797

k-doering-NOAA commented 11 months ago

Ah, good point about that one, thanks!

I think there were a few that are similar, that are in the FIMS code, e.g.,

/home/runner/work/FIMS/FIMS/tests/gtest/test_population_Unfished_Initial.cpp:23:28: warning: Value stored to 'index_yf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
                    size_t index_yf = year * population.nfleets + fleet_index;
                           ^~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/FIMS/FIMS/tests/gtest/test_population_Unfished_Initial.cpp:23:28: note: Value stored to 'index_yf' during its initialization is never read
                    size_t index_yf = year * population.nfleets + fleet_index;
                           ^~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~