flow problem (?): bogus warning
Joe Buck
jbuck@synopsys.com
Thu Nov 6 15:17:00 GMT 1997
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;
}
}
----------------------
More information about the Gcc
mailing list