This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[4.0.x] may reach end warning in system headers


One of our users was getting

/usr/include/gcc/darwin/4.0/c++/bits/stl_uninitialized.h:113: warning:
control may reach end of non-void function '_ForwardIterator
std::__uninitialized_copy_aux(_InputIterator, _InputIterator,
_ForwardIterator, __false_type) [with _InputIterator =
__gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*,
std::vector<TPoolAllocator::tAllocState,
std::allocator<TPoolAllocator::tAllocState> > >, _ForwardIterator =
__gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*,
std::vector<TPoolAllocator::tAllocState,
std::allocator<TPoolAllocator::tAllocState> > >]' being inlined

which shouldn't be happening, he has no way to change a standard C++
header.  The warning is bogus anyway, but it's fixed in 4.1 through
the CFG changes, which I don't really want to backport to the 4.0
branch, so instead I'll add this patch.  Other warnings generated from
tree-inline.c check for DECL_SYSTEM_HEADER like this.

Bootstrapped & tested on powerpc-darwin8, I'll commit when the branch
is unfrozen.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-40-4121982.patch======================
Index: ChangeLog
2005-06-28  Geoffrey Keating  <geoffk@apple.com>

	* tree-inline.c (expand_call_inline): Prevent 'may reach end'
	warning in system headers.

Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.170.8.4
diff -u -p -u -p -r1.170.8.4 tree-inline.c
--- tree-inline.c	6 Jun 2005 19:20:32 -0000	1.170.8.4
+++ tree-inline.c	1 Jul 2005 18:27:26 -0000
@@ -1693,7 +1693,8 @@ expand_call_inline (tree *tp, int *walk_
 	&& !TREE_NO_WARNING (fn)
 	&& !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fn)))
 	&& return_slot_addr == NULL_TREE
-	&& block_may_fallthru (copy))
+	&& block_may_fallthru (copy)
+	&& !DECL_IN_SYSTEM_HEADER (fn))
       {
 	warning ("control may reach end of non-void function %qD being inlined",
 		 fn);
============================================================


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