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

Add parens to assignment in conditional

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.0, 4.9.0-rc1, 4.4.7, 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None

      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.

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

              Created:
              Updated:
              Resolved: