first commit
This commit is contained in:
6
extern/STLport/5.2.1/test/compiler/Makefile.inc
vendored
Normal file
6
extern/STLport/5.2.1/test/compiler/Makefile.inc
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- makefile -*- Time-stamp: <04/10/17 21:16:38 ptr>
|
||||
|
||||
PRGNAME = compiler_test
|
||||
SRC_CPP = ttei1.cpp ttei2.cpp ttei3.cpp ttei4.cpp ttei5.cpp ttei6.cpp ttei7.cpp \
|
||||
partial_spec.cpp movable.cpp
|
||||
SRC_CC = eh.cc
|
||||
29
extern/STLport/5.2.1/test/compiler/README
vendored
Normal file
29
extern/STLport/5.2.1/test/compiler/README
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
1. About this tests
|
||||
|
||||
This is tests to check whether compiler understand or not some language
|
||||
construction. It is NOT tests for language support libraries, only tests for
|
||||
compiler!
|
||||
|
||||
The main purposes of this tests is to help for developers to find correct
|
||||
workarounds, if compiler don't understand some (correct) language constructions.
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
2. Compilation
|
||||
|
||||
Compilation with GNU Make utility and gcc compiler:
|
||||
|
||||
make -f gcc.mak -k
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
Notes about tests.
|
||||
|
||||
ttei1.cpp, ttei2.cpp, ttei3.cpp, ttei4.cpp, ttei5.cpp:
|
||||
|
||||
tests for template-in-the-template explicit specialization.
|
||||
Indeed ttei3.cpp, ttei4.cpp, ttei5.cpp suggest syntax not approved by standard
|
||||
(14.7.3, paragraphs 16--18), but ttei3.cpp, ttei4.cpp accepted (recheck!) by VC6,
|
||||
while ttei5.cpp accepted by gcc before 3.4.0.
|
||||
12
extern/STLport/5.2.1/test/compiler/StTerm-order/Makefile
vendored
Normal file
12
extern/STLport/5.2.1/test/compiler/StTerm-order/Makefile
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr>
|
||||
|
||||
SRCROOT := ../../../build
|
||||
COMPILER_NAME := gcc
|
||||
|
||||
# WITHOUT_STLPORT = 1
|
||||
# STLPORT_DIR := ../../..
|
||||
include Makefile.inc
|
||||
include ${SRCROOT}/Makefiles/top.mak
|
||||
|
||||
#CXXFLAGS += -fuse-cxa-atexit
|
||||
LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR}
|
||||
4
extern/STLport/5.2.1/test/compiler/StTerm-order/Makefile.inc
vendored
Normal file
4
extern/STLport/5.2.1/test/compiler/StTerm-order/Makefile.inc
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr>
|
||||
|
||||
PRGNAME = stterm-test
|
||||
SRC_CC = stterm-test.cc
|
||||
117
extern/STLport/5.2.1/test/compiler/StTerm-order/stterm-test.cc
vendored
Normal file
117
extern/STLport/5.2.1/test/compiler/StTerm-order/stterm-test.cc
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* The conversation with Matti Rintala on STLport forum 2005-08-24:
|
||||
*
|
||||
* Do you mean ISO/IEC 14882 3.6.3 [basic.start.term]?
|
||||
*
|
||||
* Yes. "Destructors (12.4) for initialized objects of static storage duration
|
||||
* (declared at block scope or at namespace scope) are called as a result
|
||||
* of returning from main and as a result of calling exit (18.3). These objects
|
||||
* are destroyed in the reverse order of the completion of their constructor
|
||||
* or of the completion of their dynamic initialization."
|
||||
*
|
||||
* I found a confirmation on the web that gcc may not strictly conform
|
||||
* to this behaviour in certains cases unless -fuse-cxa-atexit is used.
|
||||
*
|
||||
* Test below give (without -fuse-cxa-atexit)
|
||||
|
||||
Init::Init()
|
||||
Init::use_it
|
||||
It ctor done <-- 0
|
||||
Init::use_it done
|
||||
Init ctor done <-- 1
|
||||
Init2 ctor done <-- 2
|
||||
It dtor done <-- 0
|
||||
Init2 dtor done <-- 2
|
||||
Init dtor done <-- 1
|
||||
|
||||
|
||||
* but should:
|
||||
|
||||
Init::Init()
|
||||
Init::use_it
|
||||
It ctor done <-- 0
|
||||
Init::use_it done
|
||||
Init ctor done <-- 1
|
||||
Init2 ctor done <-- 2
|
||||
Init2 dtor done <-- 2
|
||||
Init dtor done <-- 1
|
||||
It dtor done <-- 0
|
||||
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Init
|
||||
{
|
||||
public:
|
||||
Init();
|
||||
~Init();
|
||||
|
||||
static void use_it();
|
||||
};
|
||||
|
||||
class Init2
|
||||
{
|
||||
public:
|
||||
Init2();
|
||||
~Init2();
|
||||
|
||||
};
|
||||
|
||||
static Init init;
|
||||
static Init2 init2;
|
||||
|
||||
class It
|
||||
{
|
||||
public:
|
||||
It();
|
||||
~It();
|
||||
};
|
||||
|
||||
Init::Init()
|
||||
{
|
||||
printf( "Init::Init()\n" );
|
||||
use_it();
|
||||
printf( "Init ctor done\n" );
|
||||
}
|
||||
|
||||
Init::~Init()
|
||||
{
|
||||
printf( "Init dtor done\n" );
|
||||
}
|
||||
|
||||
void Init::use_it()
|
||||
{
|
||||
printf( "Init::use_it\n" );
|
||||
|
||||
static It it;
|
||||
|
||||
printf( "Init::use_it done\n" );
|
||||
}
|
||||
|
||||
Init2::Init2()
|
||||
{
|
||||
printf( "Init2 ctor done\n" );
|
||||
}
|
||||
|
||||
Init2::~Init2()
|
||||
{
|
||||
printf( "Init2 dtor done\n" );
|
||||
}
|
||||
|
||||
It::It()
|
||||
{
|
||||
printf( "It ctor done\n" );
|
||||
}
|
||||
|
||||
It::~It()
|
||||
{
|
||||
printf( "It dtor done\n" );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
60
extern/STLport/5.2.1/test/compiler/eh.cc
vendored
Normal file
60
extern/STLport/5.2.1/test/compiler/eh.cc
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <list> /* required, to expose allocator */
|
||||
#include <stdexcept>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct BigStruct
|
||||
{
|
||||
char _data[4096];
|
||||
};
|
||||
|
||||
void bad_alloc_test()
|
||||
{
|
||||
typedef allocator<BigStruct> BigStructAllocType;
|
||||
BigStructAllocType bigStructAlloc;
|
||||
|
||||
try {
|
||||
//Lets try to allocate almost 4096 Go (on most of the platforms) of memory:
|
||||
BigStructAllocType::pointer pbigStruct = bigStructAlloc.allocate(1024 * 1024 * 1024);
|
||||
|
||||
// CPPUNIT_ASSERT( pbigStruct != 0 && "Allocation failed but no exception thrown" );
|
||||
}
|
||||
catch (bad_alloc const&) {
|
||||
printf( "Ok\n" );
|
||||
}
|
||||
catch (...) {
|
||||
//We shouldn't be there:
|
||||
// CPPUNIT_ASSERT( false && "Not bad_alloc exception thrown." );
|
||||
}
|
||||
}
|
||||
|
||||
void bad_alloc_test1()
|
||||
{
|
||||
try {
|
||||
allocator<BigStruct> all;
|
||||
BigStruct *bs = all.allocate(1024*1024*1024);
|
||||
|
||||
// throw bad_alloc();
|
||||
}
|
||||
catch ( bad_alloc const & ) {
|
||||
printf( "I am here\n" );
|
||||
}
|
||||
catch ( ... ) {
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
bad_alloc_test();
|
||||
#if 0
|
||||
try {
|
||||
throw bad_alloc();
|
||||
}
|
||||
catch ( bad_alloc& ) {
|
||||
}
|
||||
catch ( ... ) {
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
12
extern/STLport/5.2.1/test/compiler/gcc.mak
vendored
Normal file
12
extern/STLport/5.2.1/test/compiler/gcc.mak
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# -*- Makefile -*- Time-stamp: <04/03/14 23:50:57 ptr>
|
||||
|
||||
SRCROOT := ../../build
|
||||
COMPILER_NAME := gcc
|
||||
|
||||
ALL_TAGS := compile-only
|
||||
STLPORT_DIR := ../..
|
||||
include Makefile.inc
|
||||
include ${SRCROOT}/Makefiles/top.mak
|
||||
|
||||
compile-only: $(OUTPUT_DIRS) $(OBJ)
|
||||
|
||||
20
extern/STLport/5.2.1/test/compiler/movable.cpp
vendored
Normal file
20
extern/STLport/5.2.1/test/compiler/movable.cpp
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct S :
|
||||
public string
|
||||
{
|
||||
};
|
||||
|
||||
void test()
|
||||
{
|
||||
list<S> l;
|
||||
l.push_back( S() );
|
||||
|
||||
vector<S> v;
|
||||
v.push_back( S() );
|
||||
}
|
||||
|
||||
34
extern/STLport/5.2.1/test/compiler/partial_spec.cpp
vendored
Normal file
34
extern/STLport/5.2.1/test/compiler/partial_spec.cpp
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* It is known that this code not compiled by following compilers:
|
||||
*
|
||||
* MSVC 6
|
||||
*
|
||||
* It is known that this code compiled by following compilers:
|
||||
*
|
||||
* MSVC 8
|
||||
* gcc 4.1.1
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code represent what STLport waits from a compiler which support
|
||||
* the partial template function ordering (!_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
|
||||
*/
|
||||
|
||||
template <class T1>
|
||||
struct template_struct {};
|
||||
|
||||
template <class T1>
|
||||
int func(T1 p1);
|
||||
|
||||
template <class T1>
|
||||
int func(template_struct<T1>);
|
||||
|
||||
|
||||
int foo()
|
||||
{
|
||||
int tmp1 = 0;
|
||||
template_struct<int> tmp2;
|
||||
func(tmp1);
|
||||
func(tmp2);
|
||||
return 0;
|
||||
}
|
||||
31
extern/STLport/5.2.1/test/compiler/ttei1.cpp
vendored
Normal file
31
extern/STLport/5.2.1/test/compiler/ttei1.cpp
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* It is known that this code not compiled by following compilers:
|
||||
* gcc 2.95.3
|
||||
* MSVC 6
|
||||
*
|
||||
* It is known that this code compiled by following compilers:
|
||||
* gcc 3.3.3
|
||||
* gcc 3.4.1
|
||||
* MSVC 8 Beta
|
||||
*/
|
||||
|
||||
struct A
|
||||
{
|
||||
private:
|
||||
struct B
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
|
||||
template <bool V>
|
||||
struct C
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
template <> template <typename T>
|
||||
void A::B::C<true>::f( T& ) {}
|
||||
|
||||
31
extern/STLport/5.2.1/test/compiler/ttei2.cpp
vendored
Normal file
31
extern/STLport/5.2.1/test/compiler/ttei2.cpp
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* It is known that this code not compiled by following compilers:
|
||||
*
|
||||
* It is known that this code compiled by following compilers:
|
||||
* gcc 2.95.3
|
||||
* gcc 3.3.3
|
||||
* gcc 3.4.1
|
||||
* MSVC 6
|
||||
* MSVC 8
|
||||
*/
|
||||
|
||||
struct A
|
||||
{
|
||||
private:
|
||||
struct B
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
|
||||
template <bool V>
|
||||
struct C
|
||||
{
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct A::B::C<true>
|
||||
{
|
||||
};
|
||||
|
||||
43
extern/STLport/5.2.1/test/compiler/ttei3.cpp
vendored
Normal file
43
extern/STLport/5.2.1/test/compiler/ttei3.cpp
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* It is known that this code not compiled by following compilers:
|
||||
* gcc 2.95.3
|
||||
* gcc 3.3.3
|
||||
* gcc 3.4.1
|
||||
* gcc 4.1.1
|
||||
*
|
||||
* It is known that this code compiled by following compilers:
|
||||
*
|
||||
* MSVC 6
|
||||
* MSVC 8 Beta
|
||||
*/
|
||||
|
||||
/*
|
||||
* Indeed this code is wrong: explicit template specialization
|
||||
* have to appear out-of-class.
|
||||
*
|
||||
*/
|
||||
|
||||
struct A
|
||||
{
|
||||
private:
|
||||
struct B
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
|
||||
template <bool V>
|
||||
struct C
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct C<true>
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
42
extern/STLport/5.2.1/test/compiler/ttei4.cpp
vendored
Normal file
42
extern/STLport/5.2.1/test/compiler/ttei4.cpp
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* It is known that this code not compiled by following compilers:
|
||||
* gcc 2.95.3
|
||||
* gcc 3.3.3
|
||||
* gcc 3.4.1
|
||||
* gcc 4.1.1
|
||||
*
|
||||
* It is known that this code compiled by following compilers:
|
||||
*
|
||||
* MSVC 6
|
||||
* MSVC 8 Beta
|
||||
*/
|
||||
|
||||
/*
|
||||
* Indeed this code is wrong: 1. explicit template specialization
|
||||
* have to appear out-of-class; 2. specialized struct C have to
|
||||
* have function f.
|
||||
*
|
||||
*/
|
||||
|
||||
struct A
|
||||
{
|
||||
private:
|
||||
struct B
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
|
||||
template <bool V>
|
||||
struct C
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct C<true>
|
||||
{
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
43
extern/STLport/5.2.1/test/compiler/ttei5.cpp
vendored
Normal file
43
extern/STLport/5.2.1/test/compiler/ttei5.cpp
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* It is known that this code not compiled by following compilers:
|
||||
* gcc 3.4.1
|
||||
* gcc 4.1.1
|
||||
*
|
||||
* It is known that this code compiled by following compilers:
|
||||
* gcc 2.95.3
|
||||
* gcc 3.3.3
|
||||
*
|
||||
* MSVC 6
|
||||
* MSVC 8 Beta
|
||||
*/
|
||||
|
||||
/*
|
||||
* Indeed this code is wrong: explicit template specialization
|
||||
* have to appear out-of-class.
|
||||
*
|
||||
*/
|
||||
|
||||
struct A
|
||||
{
|
||||
private:
|
||||
struct B
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
|
||||
template <bool V>
|
||||
struct C
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct C<true>
|
||||
{
|
||||
template <typename T>
|
||||
static void f( T& ) {}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
30
extern/STLport/5.2.1/test/compiler/ttei6.cpp
vendored
Normal file
30
extern/STLport/5.2.1/test/compiler/ttei6.cpp
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* It is known that this code not compiled by following compilers:
|
||||
*
|
||||
* It is known that this code compiled by following compilers:
|
||||
*
|
||||
* MSVC 6
|
||||
* MSVC 8 Beta
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code represent what STLport waits from a compiler which support
|
||||
* member template classes (!_STLP_NO_MEMBER_TEMPLATE_CLASSES)
|
||||
*/
|
||||
|
||||
template <typename T1>
|
||||
struct A
|
||||
{
|
||||
template <typename T2>
|
||||
struct B
|
||||
{
|
||||
typedef T2 _Type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct C
|
||||
{
|
||||
typedef typename A<T1>:: template B<T2>::_Type ABType;
|
||||
};
|
||||
31
extern/STLport/5.2.1/test/compiler/ttei7.cpp
vendored
Normal file
31
extern/STLport/5.2.1/test/compiler/ttei7.cpp
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* It is known that this code not compiled by following compilers:
|
||||
*
|
||||
* MSVC 6
|
||||
*
|
||||
* It is known that this code compiled by following compilers:
|
||||
*
|
||||
* MSVC 8 Beta
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code represent what STLport waits from a compiler which support
|
||||
* the rebind member template class technique (!_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
|
||||
*/
|
||||
|
||||
template <typename T1>
|
||||
struct A
|
||||
{
|
||||
template <typename T2>
|
||||
struct B
|
||||
{
|
||||
typedef A<T2> _Type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <typename T, typename A>
|
||||
struct C
|
||||
{
|
||||
typedef typename A:: template B<T>::_Type _ATType;
|
||||
};
|
||||
Reference in New Issue
Block a user