fuzz: fix unused variable compiler warning #18664

pull jonatack wants to merge 1 commits into bitcoin:master from jonatack:fix-unused-variable-warning changing 1 files +4 −2
  1. jonatack commented at 11:28 AM on April 16, 2020: member

    Fixes the compiler warning while hopefully not invalidating the existing seeds. Added an explanatory comment.

    test/fuzz/locale.cpp:59:19: warning: unused variable 'random_int32' [-Wunused-variable]
        const int32_t random_int32 = fuzzed_data_provider.ConsumeIntegral<int32_t>();
    
  2. fanquake added the label Tests on Apr 16, 2020
  3. fanquake requested review from MarcoFalke on Apr 17, 2020
  4. fanquake requested review from practicalswift on Apr 17, 2020
  5. practicalswift commented at 7:58 AM on April 17, 2020: contributor

    Concept ACK on fixing this compiler warning: thanks for addressing this! :)

    Regarding the implementation: I think this is what you want to do in order to not invalidate the existing fuzzing seeds:

    diff --git a/src/test/fuzz/locale.cpp b/src/test/fuzz/locale.cpp
    index 09580c0c5..27047fc84 100644
    --- a/src/test/fuzz/locale.cpp
    +++ b/src/test/fuzz/locale.cpp
    @@ -57,6 +57,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
         const int64_t random_int64 = fuzzed_data_provider.ConsumeIntegral<int64_t>();
         const std::string tostring_without_locale = ToString(random_int64);
         const int32_t random_int32 = fuzzed_data_provider.ConsumeIntegral<int32_t>();
    +    (void)random_int32;
         const std::string strprintf_int_without_locale = strprintf("%d", random_int64);
         const double random_double = fuzzed_data_provider.ConsumeFloatingPoint<double>();
         const std::string strprintf_double_without_locale = strprintf("%f", random_double);
    

    While you're touching this file you might want to clang-format -i src/test/fuzz/locale.cpp as an added tidyness bonus :)

  6. fuzz: fix unused variable compiler warning eab7367e25
  7. jonatack force-pushed on Apr 17, 2020
  8. jonatack commented at 11:51 AM on April 17, 2020: member

    @practicalswift oooops, thanks! Updated.

  9. practicalswift approved
  10. practicalswift commented at 12:53 PM on April 17, 2020: contributor

    ACK eab7367e25e35688a4d4a6c96701dd7149134df5

  11. MarcoFalke merged this on Apr 17, 2020
  12. MarcoFalke closed this on Apr 17, 2020

  13. jonatack deleted the branch on Apr 17, 2020
  14. Fabcien referenced this in commit b8d4c2553d on Jan 21, 2021
  15. DrahtBot locked this on Feb 15, 2022


MarcoFalke

Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me