This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

flow problem (?): bogus warning


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;
    }
}
----------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]