This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
flow problem (?): bogus warning
- To: egcs at cygnus dot com (egcs team)
- Subject: flow problem (?): bogus warning
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Thu, 6 Nov 97 15:00:25 PST
Most bogus -Wall warnings from STL code reduce to the following case:
% gcc -Wall -c tthr.cxx
tthr.cxx: In function `struct T * ucopy(const struct T *, const struct T *, struct T *)':
tthr.cxx:20: warning: control reaches end of non-void function `ucopy(const T *, const T *, T *)'
Can gcc be taught that functions of this form don't reach the end?
----------------------
struct T {
int data;
};
void destroy(T* first, T* last);
void construct(T* p, const T&value);
T* ucopy(const T* first, const T* last, T* result)
{
T* cur = result;
try {
for (; first != last; ++first, ++cur)
construct(&*cur, *first);
return cur;
}
catch (...) {
destroy(result, cur);
throw;
}
}
----------------------