patches/gcc/4.0.1/pr21951-fix2.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
yann@1
     1
Workaround for buglet in std::vector etc. when compiling
yann@1
     2
with gcc-4.0.1 -Wall -O -fno-exceptions
yann@1
     3
Fixes:
yann@1
     4
yann@1
     5
.../include/c++/4.0.0/bits/vector.tcc: In member function 'void std::vector<_Tp,
yann@1
     6
_Alloc>::reserve(size_t) [with _Tp = int, _Alloc = std::allocator<int>]':
yann@1
     7
.../include/c++/4.0.0/bits/vector.tcc:78: warning: control may reach end of
yann@1
     8
non-void function 'typename _Alloc::pointer std::vector<_Tp,
yann@1
     9
_Alloc>::_M_allocate_and_copy(size_t, _ForwardIterator, _ForwardIterator) [with
yann@1
    10
_ForwardIterator = int*, _Tp = int, _Alloc = std::allocator<int>]' being inlined
yann@1
    11
yann@1
    12
See http://gcc.gnu.org/PR21951
yann@1
    13
yann@1
    14
To: gcc-patches at gcc dot gnu dot org
yann@1
    15
Subject: [4.0.x] may reach end warning in system headers
yann@1
    16
Message-Id: <20050701183024.E138714C16A9@geoffk5.apple.com>
yann@1
    17
Date: Fri,  1 Jul 2005 11:30:24 -0700 (PDT)
yann@1
    18
From: gkeating at apple dot com (Geoffrey Keating)
yann@1
    19
yann@1
    20
yann@1
    21
One of our users was getting
yann@1
    22
yann@1
    23
/usr/include/gcc/darwin/4.0/c++/bits/stl_uninitialized.h:113: warning:
yann@1
    24
control may reach end of non-void function '_ForwardIterator
yann@1
    25
std::__uninitialized_copy_aux(_InputIterator, _InputIterator,
yann@1
    26
_ForwardIterator, __false_type) [with _InputIterator =
yann@1
    27
__gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*,
yann@1
    28
std::vector<TPoolAllocator::tAllocState,
yann@1
    29
std::allocator<TPoolAllocator::tAllocState> > >, _ForwardIterator =
yann@1
    30
__gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*,
yann@1
    31
std::vector<TPoolAllocator::tAllocState,
yann@1
    32
std::allocator<TPoolAllocator::tAllocState> > >]' being inlined
yann@1
    33
yann@1
    34
which shouldn't be happening, he has no way to change a standard C++
yann@1
    35
header.  The warning is bogus anyway, but it's fixed in 4.1 through
yann@1
    36
the CFG changes, which I don't really want to backport to the 4.0
yann@1
    37
branch, so instead I'll add this patch.  Other warnings generated from
yann@1
    38
tree-inline.c check for DECL_SYSTEM_HEADER like this.
yann@1
    39
yann@1
    40
Bootstrapped & tested on powerpc-darwin8, I'll commit when the branch
yann@1
    41
is unfrozen.
yann@1
    42
yann@1
    43
-- 
yann@1
    44
- Geoffrey Keating <geoffk@apple.com>
yann@1
    45
yann@1
    46
===File ~/patches/gcc-40-4121982.patch======================
yann@1
    47
Index: ChangeLog
yann@1
    48
2005-06-28  Geoffrey Keating  <geoffk@apple.com>
yann@1
    49
yann@1
    50
	* tree-inline.c (expand_call_inline): Prevent 'may reach end'
yann@1
    51
	warning in system headers.
yann@1
    52
yann@1
    53
Index: tree-inline.c
yann@1
    54
===================================================================
yann@1
    55
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
yann@1
    56
retrieving revision 1.170.8.4
yann@1
    57
diff -u -p -u -p -r1.170.8.4 tree-inline.c
yann@1
    58
--- gcc-4.0.1/gcc/tree-inline.c.old	6 Jun 2005 19:20:32 -0000	1.170.8.4
yann@1
    59
+++ gcc-4.0.1/gcc/tree-inline.c	1 Jul 2005 18:27:26 -0000
yann@1
    60
@@ -1693,7 +1693,8 @@ expand_call_inline (tree *tp, int *walk_
yann@1
    61
 	&& !TREE_NO_WARNING (fn)
yann@1
    62
 	&& !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fn)))
yann@1
    63
 	&& return_slot_addr == NULL_TREE
yann@1
    64
-	&& block_may_fallthru (copy))
yann@1
    65
+	&& block_may_fallthru (copy)
yann@1
    66
+	&& !DECL_IN_SYSTEM_HEADER (fn))
yann@1
    67
       {
yann@1
    68
 	warning ("control may reach end of non-void function %qD being inlined",
yann@1
    69
 		 fn);
yann@1
    70
============================================================
yann@1
    71