patches/gcc/4.0.1/120-pr21951-fix2.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Feb 17 22:08:06 2008 +0000 (2008-02-17)
changeset 431 8bde4c6ea47a
permissions -rw-r--r--
Robert P. J. DAY says:

apparently, the patchset for gcc 4.2.1 applies properly to the
source for gcc 4.2.2 and gcc 4.2.3. so, if you want, you can simply
add support for those last two just by augmenting menuconfig and
adding a couple symlinks for those two directories. seems like a
cheap way to add a couple new versions.
     1 Workaround for buglet in std::vector etc. when compiling
     2 with gcc-4.0.1 -Wall -O -fno-exceptions
     3 Fixes:
     4 
     5 .../include/c++/4.0.0/bits/vector.tcc: In member function 'void std::vector<_Tp,
     6 _Alloc>::reserve(size_t) [with _Tp = int, _Alloc = std::allocator<int>]':
     7 .../include/c++/4.0.0/bits/vector.tcc:78: warning: control may reach end of
     8 non-void function 'typename _Alloc::pointer std::vector<_Tp,
     9 _Alloc>::_M_allocate_and_copy(size_t, _ForwardIterator, _ForwardIterator) [with
    10 _ForwardIterator = int*, _Tp = int, _Alloc = std::allocator<int>]' being inlined
    11 
    12 See http://gcc.gnu.org/PR21951
    13 
    14 To: gcc-patches at gcc dot gnu dot org
    15 Subject: [4.0.x] may reach end warning in system headers
    16 Message-Id: <20050701183024.E138714C16A9@geoffk5.apple.com>
    17 Date: Fri,  1 Jul 2005 11:30:24 -0700 (PDT)
    18 From: gkeating at apple dot com (Geoffrey Keating)
    19 
    20 
    21 One of our users was getting
    22 
    23 /usr/include/gcc/darwin/4.0/c++/bits/stl_uninitialized.h:113: warning:
    24 control may reach end of non-void function '_ForwardIterator
    25 std::__uninitialized_copy_aux(_InputIterator, _InputIterator,
    26 _ForwardIterator, __false_type) [with _InputIterator =
    27 __gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*,
    28 std::vector<TPoolAllocator::tAllocState,
    29 std::allocator<TPoolAllocator::tAllocState> > >, _ForwardIterator =
    30 __gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*,
    31 std::vector<TPoolAllocator::tAllocState,
    32 std::allocator<TPoolAllocator::tAllocState> > >]' being inlined
    33 
    34 which shouldn't be happening, he has no way to change a standard C++
    35 header.  The warning is bogus anyway, but it's fixed in 4.1 through
    36 the CFG changes, which I don't really want to backport to the 4.0
    37 branch, so instead I'll add this patch.  Other warnings generated from
    38 tree-inline.c check for DECL_SYSTEM_HEADER like this.
    39 
    40 Bootstrapped & tested on powerpc-darwin8, I'll commit when the branch
    41 is unfrozen.
    42 
    43 -- 
    44 - Geoffrey Keating <geoffk@apple.com>
    45 
    46 ===File ~/patches/gcc-40-4121982.patch======================
    47 Index: ChangeLog
    48 2005-06-28  Geoffrey Keating  <geoffk@apple.com>
    49 
    50 	* tree-inline.c (expand_call_inline): Prevent 'may reach end'
    51 	warning in system headers.
    52 
    53 Index: tree-inline.c
    54 ===================================================================
    55 RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
    56 retrieving revision 1.170.8.4
    57 diff -u -p -u -p -r1.170.8.4 tree-inline.c
    58 --- gcc-4.0.1/gcc/tree-inline.c.old	6 Jun 2005 19:20:32 -0000	1.170.8.4
    59 +++ gcc-4.0.1/gcc/tree-inline.c	1 Jul 2005 18:27:26 -0000
    60 @@ -1693,7 +1693,8 @@ expand_call_inline (tree *tp, int *walk_
    61  	&& !TREE_NO_WARNING (fn)
    62  	&& !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fn)))
    63  	&& return_slot_addr == NULL_TREE
    64 -	&& block_may_fallthru (copy))
    65 +	&& block_may_fallthru (copy)
    66 +	&& !DECL_IN_SYSTEM_HEADER (fn))
    67        {
    68  	warning ("control may reach end of non-void function %qD being inlined",
    69  		 fn);
    70 ============================================================
    71