Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-9760

Fix implicit conversion in workgen.cxx

    • 2
    • StorEng - Defined Pipeline

      I ran into the below compilation warning using Clang v10. 

      [366/542] Building CXX object bench/workgen/CMakeFiles/workgen_cxx.dir/workgen.cxx.o
      ../bench/workgen/workgen.cxx:1197:33: warning: implicit conversion from 'unsigned int' to 'float' changes value from 4294967295 to 4294967296 [-Wimplicit-int-float-conversion]
          return (((float)r * sign) / UINT32_MAX);
                                    ~ ^~~~~~~~~~
      /usr/include/stdint.h:129:23: note: expanded from macro 'UINT32_MAX'
      # define UINT32_MAX             (4294967295U)
                                       ^~~~~~~~~~~
      1 warning generated. 

      The specific cmake command used:

      $ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/clang.cmake -G Ninja ../
      -- The C compiler identification is Clang 10.0.0
      -- The CXX compiler identification is Clang 10.0.0 
      (...)

            Assignee:
            luke.chen@mongodb.com Luke Chen
            Reporter:
            luke.chen@mongodb.com Luke Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: