On Tue, 26 Jul 2016, Prathamesh Kulkarni wrote: > Many warnings for dead-calls are emitted with patch on call to > operator new in libsupc++/eh_alloc.cc, which I am not sure are correct > or false positives, for instance: > > /home/prathamesh.kulkarni/gcc-svn/trunk/libstdc++-v3/libsupc++/eh_alloc.cc:170:22: > warning: Call from void* {anonymous}::pool::allocate(std::size_t) to > void* operator new(std::size_t, void*) has no effect [-Wunused-value] > new (f) free_entry; > ^ > It appears to me new() is defined as follows in libsupc++/new: > // Default placement versions of operator new. > inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT > { return __p; } > > So could it be considered as a dead call since new() doesn't have side-effect > and it's return value is not assigned to any variable > or is the warning wrong for the above call ?
The warning is wrong as it has semantic meaning in the C++ language. Implementation-wise it is correct. A way out would be to set TREE_NO_WARNING on the call emitted by the FE. Richard.