re PR libstdc++/47185 (UB in TR1 and C++0x placeholders and non conforming implementation)

2011-01-06  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/47185
	* src/placeholders.cc: New.
	* src/Makefile.am: Adjust.
	* src/Makefile.in: Regenerate.
	* include/std/functional (placeholders::_1, _2, ..., _29): Declare
	extern.
	* config/abi/pre/gnu.ver: Export.

From-SVN: r168536
This commit is contained in:
Paolo Carlini 2011-01-06 10:14:37 +00:00 committed by Paolo Carlini
parent 210dedfec3
commit 4192922c74
6 changed files with 125 additions and 37 deletions

View file

@ -1,3 +1,13 @@
2011-01-06 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/47185
* src/placeholders.cc: New.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional (placeholders::_1, _2, ..., _29): Declare
extern.
* config/abi/pre/gnu.ver: Export.
2011-01-05 François Dumont <francois.cppdevs@free.fr>
* include/debug/safe_base.h (_Safe_iterator_base::_M_unlink): New.

View file

@ -1196,6 +1196,9 @@ GLIBCXX_3.4.15 {
# std::future_category is now a function
_ZSt15future_categoryv;
# std::placeholders
_ZNSt12placeholders*;
} GLIBCXX_3.4.14;
# Symbols in the support library (libsupc++) have their own tag.

View file

@ -844,39 +844,36 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
* unique names for each.
*/
namespace placeholders
{
namespace
{
_Placeholder<1> _1;
_Placeholder<2> _2;
_Placeholder<3> _3;
_Placeholder<4> _4;
_Placeholder<5> _5;
_Placeholder<6> _6;
_Placeholder<7> _7;
_Placeholder<8> _8;
_Placeholder<9> _9;
_Placeholder<10> _10;
_Placeholder<11> _11;
_Placeholder<12> _12;
_Placeholder<13> _13;
_Placeholder<14> _14;
_Placeholder<15> _15;
_Placeholder<16> _16;
_Placeholder<17> _17;
_Placeholder<18> _18;
_Placeholder<19> _19;
_Placeholder<20> _20;
_Placeholder<21> _21;
_Placeholder<22> _22;
_Placeholder<23> _23;
_Placeholder<24> _24;
_Placeholder<25> _25;
_Placeholder<26> _26;
_Placeholder<27> _27;
_Placeholder<28> _28;
_Placeholder<29> _29;
}
{
extern const _Placeholder<1> _1;
extern const _Placeholder<2> _2;
extern const _Placeholder<3> _3;
extern const _Placeholder<4> _4;
extern const _Placeholder<5> _5;
extern const _Placeholder<6> _6;
extern const _Placeholder<7> _7;
extern const _Placeholder<8> _8;
extern const _Placeholder<9> _9;
extern const _Placeholder<10> _10;
extern const _Placeholder<11> _11;
extern const _Placeholder<12> _12;
extern const _Placeholder<13> _13;
extern const _Placeholder<14> _14;
extern const _Placeholder<15> _15;
extern const _Placeholder<16> _16;
extern const _Placeholder<17> _17;
extern const _Placeholder<18> _18;
extern const _Placeholder<19> _19;
extern const _Placeholder<20> _20;
extern const _Placeholder<21> _21;
extern const _Placeholder<22> _22;
extern const _Placeholder<23> _23;
extern const _Placeholder<24> _24;
extern const _Placeholder<25> _25;
extern const _Placeholder<26> _26;
extern const _Placeholder<27> _27;
extern const _Placeholder<28> _28;
extern const _Placeholder<29> _29;
}
/**

View file

@ -207,6 +207,7 @@ sources = \
locale-inst.cc \
misc-inst.cc \
ostream-inst.cc \
placeholders.cc \
sstream-inst.cc \
streambuf-inst.cc \
streambuf.cc \
@ -354,6 +355,11 @@ debug.lo: debug.cc
debug.o: debug.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
placeholders.lo: placeholders.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
placeholders.o: placeholders.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
if GLIBCXX_LDBL_COMPAT
# Use special rules for compatibility-ldbl.cc compilation, as we need to
# pass -mlong-double-64.

View file

@ -109,10 +109,11 @@ am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
strstream.lo system_error.lo tree.lo allocator-inst.lo \
concept-inst.lo fstream-inst.lo ext-inst.lo ios-inst.lo \
iostream-inst.lo istream-inst.lo istream.lo locale-inst.lo \
misc-inst.lo ostream-inst.lo sstream-inst.lo streambuf-inst.lo \
streambuf.lo string-inst.lo valarray-inst.lo wlocale-inst.lo \
wstring-inst.lo mutex.lo condition_variable.lo chrono.lo \
thread.lo future.lo $(am__objects_1) $(am__objects_4)
misc-inst.lo ostream-inst.lo placeholders.lo sstream-inst.lo \
streambuf-inst.lo streambuf.lo string-inst.lo valarray-inst.lo \
wlocale-inst.lo wstring-inst.lo mutex.lo condition_variable.lo \
chrono.lo thread.lo future.lo $(am__objects_1) \
$(am__objects_4)
am_libstdc___la_OBJECTS = $(am__objects_5)
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
@ -422,6 +423,7 @@ sources = \
locale-inst.cc \
misc-inst.cc \
ostream-inst.cc \
placeholders.cc \
sstream-inst.cc \
streambuf-inst.cc \
streambuf.cc \
@ -941,6 +943,11 @@ debug.lo: debug.cc
debug.o: debug.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
placeholders.lo: placeholders.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
placeholders.o: placeholders.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
# Use special rules for compatibility-ldbl.cc compilation, as we need to
# pass -mlong-double-64.
@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc

View file

@ -0,0 +1,65 @@
// std::placeholders -*- C++ -*-
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#ifndef __GXX_EXPERIMENTAL_CXX0X__
# error "placeholders.cc must be compiled with -std=gnu++0x"
#endif
#include <functional>
namespace std
{
namespace placeholders
{
extern const _Placeholder<1> _1{};
extern const _Placeholder<2> _2{};
extern const _Placeholder<3> _3{};
extern const _Placeholder<4> _4{};
extern const _Placeholder<5> _5{};
extern const _Placeholder<6> _6{};
extern const _Placeholder<7> _7{};
extern const _Placeholder<8> _8{};
extern const _Placeholder<9> _9{};
extern const _Placeholder<10> _10{};
extern const _Placeholder<11> _11{};
extern const _Placeholder<12> _12{};
extern const _Placeholder<13> _13{};
extern const _Placeholder<14> _14{};
extern const _Placeholder<15> _15{};
extern const _Placeholder<16> _16{};
extern const _Placeholder<17> _17{};
extern const _Placeholder<18> _18{};
extern const _Placeholder<19> _19{};
extern const _Placeholder<20> _20{};
extern const _Placeholder<21> _21{};
extern const _Placeholder<22> _22{};
extern const _Placeholder<23> _23{};
extern const _Placeholder<24> _24{};
extern const _Placeholder<25> _25{};
extern const _Placeholder<26> _26{};
extern const _Placeholder<27> _27{};
extern const _Placeholder<28> _28{};
extern const _Placeholder<29> _29{};
}
}