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

Coverity analysis defect 138259: Parse warning

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.2.0, 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • 3
    • StorEng - 2023-08-08

      In WT-11272 the type member of struct __wt_update was made const. As C does not support for constructors and it is UB in the standard [C11 6.7.3] to change the value by casting away the const. While it is possible to work around the UB say be using memcpy as suggested by luke.pearson@mongodb.com, the question remains whether it the value of the idiom justifies the work. Practically speaking propagation of the idiom would likely cause constant warnings from Coverity and potentially other tools.

      Parse warning
      
       A parse warning may reduce maintainability of the code, or it may indicate a serious error. A parse warning from the Coverity parser may indicate a bug, or poor coding practice
      /src/include/btmem.h:1289: PW.NO_CTOR_BUT_CONST_OR_REF_MEMBER 138259 class "__wt_update" defines no constructor to initialize the following:
      /src/include/btmem.h:1289: PW.NO_CTOR_BUT_CONST_OR_REF_MEMBER 138259 const member "__wt_update::type"
      

            Assignee:
            marc.butler@mongodb.com Marc Butler
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: