#15027 closed defect (fixed)

Clang++ compiler warning about unused result in src/common/fswatchercmn.cpp

Reported by: ettl.martin Owned by:
Priority: normal Milestone:
Component: GUI-all Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

Compiling current head of wxWidgets with clang(3.2) gives the following warning

../src/common/fswatchercmn.cpp:133:31: warning: expression result unused [-Wunused-value]
        m_watches.insert(val).second;
        ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~

Here is a piece of the source:

...
    wxFSWatchInfoMap::iterator it = m_watches.find(canonical);
    if ( it == m_watches.end() )
    {
        wxFSWatchInfoMap::value_type val(canonical, watch);
        m_watches.insert(val).second; // <----
    }
...

As far as i can see, the expression can be simplified to

...
    wxFSWatchInfoMap::iterator it = m_watches.find(canonical);
    if ( it == m_watches.end() )
    {
        wxFSWatchInfoMap::value_type val(canonical, watch);
        m_watches.insert(val); // <----
    }
...

Please refer the attached patch.

Best regards and many thanks

Martin Ettl

Attachments (1)

bugfix.patch download (416 bytes) - added by ettl.martin 20 months ago.
proposed patch

Download all attachments as: .zip

Change History (2)

Changed 20 months ago by ettl.martin

proposed patch

comment:1 Changed 20 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [73464]) No changes, just remove unused part of expression.

We don't do anything with the result of inserting the watch in
fswatchercmn.cpp.

Closes #15027.

Note: See TracTickets for help on using tickets.