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

Add parens to assignment in conditional

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT10.0.0, 5.0.0
    • Component/s: None
    • Labels:
      None

      Description

      The merge of WT-7332 introduced this line to workgen.cxx:181 that I'm now getting warnings about. Basically the assignment to ret is missing a pair of parens and it is assigning and comparing incorrectly.

        CXX      workgen.lo
      ../../../bench/workgen/workgen.cxx:181:13: warning: using the result of an
            assignment as a condition without parentheses [-Wparentheses]
          if (ret = conn->open_session(conn, NULL, NULL, &session) != 0) {
              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../../bench/workgen/workgen.cxx:181:13: note: place parentheses around the
            assignment to silence this warning
      

      I see this warning on my Mac. I don't get the warning on AWS.

      1. This bug needs to be fixed.
      2. We need to understand why AWS and PR testing didn't see this and allow it to be caught before merge.

        Attachments

          Activity

            People

            Assignee:
            sue.loverso Susan LoVerso
            Reporter:
            sue.loverso Susan LoVerso
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: