patches/gcc/4.0.1/pr21951-fix2.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.0.1/pr21951-fix2.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,71 @@
     1.4 +Workaround for buglet in std::vector etc. when compiling
     1.5 +with gcc-4.0.1 -Wall -O -fno-exceptions
     1.6 +Fixes:
     1.7 +
     1.8 +.../include/c++/4.0.0/bits/vector.tcc: In member function 'void std::vector<_Tp,
     1.9 +_Alloc>::reserve(size_t) [with _Tp = int, _Alloc = std::allocator<int>]':
    1.10 +.../include/c++/4.0.0/bits/vector.tcc:78: warning: control may reach end of
    1.11 +non-void function 'typename _Alloc::pointer std::vector<_Tp,
    1.12 +_Alloc>::_M_allocate_and_copy(size_t, _ForwardIterator, _ForwardIterator) [with
    1.13 +_ForwardIterator = int*, _Tp = int, _Alloc = std::allocator<int>]' being inlined
    1.14 +
    1.15 +See http://gcc.gnu.org/PR21951
    1.16 +
    1.17 +To: gcc-patches at gcc dot gnu dot org
    1.18 +Subject: [4.0.x] may reach end warning in system headers
    1.19 +Message-Id: <20050701183024.E138714C16A9@geoffk5.apple.com>
    1.20 +Date: Fri,  1 Jul 2005 11:30:24 -0700 (PDT)
    1.21 +From: gkeating at apple dot com (Geoffrey Keating)
    1.22 +
    1.23 +
    1.24 +One of our users was getting
    1.25 +
    1.26 +/usr/include/gcc/darwin/4.0/c++/bits/stl_uninitialized.h:113: warning:
    1.27 +control may reach end of non-void function '_ForwardIterator
    1.28 +std::__uninitialized_copy_aux(_InputIterator, _InputIterator,
    1.29 +_ForwardIterator, __false_type) [with _InputIterator =
    1.30 +__gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*,
    1.31 +std::vector<TPoolAllocator::tAllocState,
    1.32 +std::allocator<TPoolAllocator::tAllocState> > >, _ForwardIterator =
    1.33 +__gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*,
    1.34 +std::vector<TPoolAllocator::tAllocState,
    1.35 +std::allocator<TPoolAllocator::tAllocState> > >]' being inlined
    1.36 +
    1.37 +which shouldn't be happening, he has no way to change a standard C++
    1.38 +header.  The warning is bogus anyway, but it's fixed in 4.1 through
    1.39 +the CFG changes, which I don't really want to backport to the 4.0
    1.40 +branch, so instead I'll add this patch.  Other warnings generated from
    1.41 +tree-inline.c check for DECL_SYSTEM_HEADER like this.
    1.42 +
    1.43 +Bootstrapped & tested on powerpc-darwin8, I'll commit when the branch
    1.44 +is unfrozen.
    1.45 +
    1.46 +-- 
    1.47 +- Geoffrey Keating <geoffk@apple.com>
    1.48 +
    1.49 +===File ~/patches/gcc-40-4121982.patch======================
    1.50 +Index: ChangeLog
    1.51 +2005-06-28  Geoffrey Keating  <geoffk@apple.com>
    1.52 +
    1.53 +	* tree-inline.c (expand_call_inline): Prevent 'may reach end'
    1.54 +	warning in system headers.
    1.55 +
    1.56 +Index: tree-inline.c
    1.57 +===================================================================
    1.58 +RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
    1.59 +retrieving revision 1.170.8.4
    1.60 +diff -u -p -u -p -r1.170.8.4 tree-inline.c
    1.61 +--- gcc-4.0.1/gcc/tree-inline.c.old	6 Jun 2005 19:20:32 -0000	1.170.8.4
    1.62 ++++ gcc-4.0.1/gcc/tree-inline.c	1 Jul 2005 18:27:26 -0000
    1.63 +@@ -1693,7 +1693,8 @@ expand_call_inline (tree *tp, int *walk_
    1.64 + 	&& !TREE_NO_WARNING (fn)
    1.65 + 	&& !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fn)))
    1.66 + 	&& return_slot_addr == NULL_TREE
    1.67 +-	&& block_may_fallthru (copy))
    1.68 ++	&& block_may_fallthru (copy)
    1.69 ++	&& !DECL_IN_SYSTEM_HEADER (fn))
    1.70 +       {
    1.71 + 	warning ("control may reach end of non-void function %qD being inlined",
    1.72 + 		 fn);
    1.73 +============================================================
    1.74 +