aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog15
-rw-r--r--libstdc++-v3/include/std/type_traits4
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/comparisons/comp1.cc65
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/cons/cons1.cc7
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow.cc13
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/operations/ops1.cc23
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/operations/ops2.cc15
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/operations/ops3.cc23
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow.cc11
-rw-r--r--libstdc++-v3/testsuite/lib/dg-options.exp9
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp64
12 files changed, 162 insertions, 116 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index db08bef..d4c02c7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,18 @@
+2008-07-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/lib/libstdc++.exp (check_v3_target_stdint): New.
+ * testsuite/lib/dg-options.exp (dg-require-cstdint): New.
+ * testsuite/20_util/ratio/cons/cons1.cc: Use it.
+ * testsuite/20_util/ratio/cons/cons_overflow.cc: Likewise.
+ * testsuite/20_util/ratio/operations/ops1.cc: Likewise.
+ * testsuite/20_util/ratio/operations/ops2.cc: Likewise.
+ * testsuite/20_util/ratio/operations/ops3.cc: Likewise.
+ * testsuite/20_util/ratio/operations/ops_overflow.cc: Likewise.
+ * testsuite/20_util/ratio/comparisons/comp1.cc: Likewise.
+ * testsuite/20_util/ratio/comparisons/comp2.cc: Likewise.
+
+ * include/std/type_traits: Fix comment typo.
+
2008-07-06 Roger Sayle <roger@eyesopen.com>
* include/std/system_error (is_error_code_enum): Use identifier
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 5fdc95e..6c97280 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -203,13 +203,13 @@ namespace std
: public integral_constant<bool, __has_trivial_destructor(_Tp)>
{ };
- /// has_nothrow_default_destructor
+ /// has_nothrow_default_constructor
template<typename _Tp>
struct has_nothrow_default_constructor
: public integral_constant<bool, __has_nothrow_constructor(_Tp)>
{ };
- /// has_nothrow_copy_destructor
+ /// has_nothrow_copy_constructor
template<typename _Tp>
struct has_nothrow_copy_constructor
: public integral_constant<bool, __has_nothrow_copy(_Tp)>
diff --git a/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp1.cc b/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp1.cc
index 73064c7..c916b30 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp1.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
// Copyright (C) 2008 Free Software Foundation
//
@@ -21,8 +22,6 @@
#include <ratio>
#include <testsuite_hooks.h>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
void
test01()
{
@@ -31,10 +30,10 @@ test01()
VERIFY(( std::ratio_equal<std::ratio<2,6>, std::ratio<1,3>>::value == 1 ));
VERIFY(( std::ratio_equal<std::ratio<2,6>, std::ratio<1,4>>::value == 0 ));
- VERIFY(( std::ratio_not_equal<std::ratio<2,6>,
- std::ratio<1,3>>::value == 0 ));
- VERIFY(( std::ratio_not_equal<std::ratio<2,6>,
- std::ratio<1,4>>::value == 1 ));
+ VERIFY( (std::ratio_not_equal<std::ratio<2,6>,
+ std::ratio<1,3>>::value == 0) );
+ VERIFY( (std::ratio_not_equal<std::ratio<2,6>,
+ std::ratio<1,4>>::value == 1) );
}
void
@@ -42,46 +41,42 @@ test02()
{
bool test __attribute__((unused)) = true;
- VERIFY(( std::ratio_less<std::ratio<1,4>, std::ratio<1,3>>::value == 1 ));
- VERIFY(( std::ratio_less<std::ratio<-1,3>, std::ratio<1,3>>::value == 1 ));
+ VERIFY( (std::ratio_less<std::ratio<1,4>, std::ratio<1,3>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<-1,3>, std::ratio<1,3>>::value == 1) );
- VERIFY(( std::ratio_less<std::ratio<1,3>, std::ratio<1,4>>::value == 0 ));
- VERIFY(( std::ratio_less<std::ratio<1,3>, std::ratio<-1,3>>::value == 0 ));
+ VERIFY( (std::ratio_less<std::ratio<1,3>, std::ratio<1,4>>::value == 0) );
+ VERIFY( (std::ratio_less<std::ratio<1,3>, std::ratio<-1,3>>::value == 0) );
- VERIFY(( std::ratio_less_equal<std::ratio<-1,3>,
- std::ratio<-1,3>>::value == 1 ));
- VERIFY(( std::ratio_less_equal<std::ratio<1,4>,
- std::ratio<1,3>>::value == 1 ));
+ VERIFY( (std::ratio_less_equal<std::ratio<-1,3>,
+ std::ratio<-1,3>>::value == 1) );
+ VERIFY( ( std::ratio_less_equal<std::ratio<1,4>,
+ std::ratio<1,3>>::value == 1) );
- VERIFY(( std::ratio_less_equal<std::ratio<1,4>,
- std::ratio<-1,3>>::value == 0 ));
- VERIFY(( std::ratio_less_equal<std::ratio<1,3>,
- std::ratio<-1,3>>::value == 0 ));
+ VERIFY( (std::ratio_less_equal<std::ratio<1,4>,
+ std::ratio<-1,3>>::value == 0) );
+ VERIFY( (std::ratio_less_equal<std::ratio<1,3>,
+ std::ratio<-1,3>>::value == 0) );
- VERIFY(( std::ratio_greater<std::ratio<1,3>, std::ratio<1,4>>::value == 1 ));
- VERIFY(( std::ratio_greater<std::ratio<1,3>, std::ratio<-1,3>>::value == 1 ));
+ VERIFY( (std::ratio_greater<std::ratio<1,3>, std::ratio<1,4>>::value == 1) );
+ VERIFY( (std::ratio_greater<std::ratio<1,3>, std::ratio<-1,3>>::value == 1) );
- VERIFY(( std::ratio_greater<std::ratio<1,4>, std::ratio<1,3>>::value == 0 ));
- VERIFY(( std::ratio_greater<std::ratio<-1,3>, std::ratio<1,3>>::value == 0 ));
+ VERIFY( (std::ratio_greater<std::ratio<1,4>, std::ratio<1,3>>::value == 0) );
+ VERIFY( (std::ratio_greater<std::ratio<-1,3>, std::ratio<1,3>>::value == 0) );
- VERIFY(( std::ratio_greater_equal<std::ratio<1,3>,
- std::ratio<1,3>>::value == 1 ));
- VERIFY(( std::ratio_greater_equal<std::ratio<1,3>,
- std::ratio<-1,3>>::value == 1 ));
-
- VERIFY(( std::ratio_greater_equal<std::ratio<-1,3>,
- std::ratio<1,3>>::value == 0 ));
- VERIFY(( std::ratio_greater_equal<std::ratio<1,4>,
- std::ratio<1,3>>::value == 0 ));
-}
+ VERIFY( (std::ratio_greater_equal<std::ratio<1,3>,
+ std::ratio<1,3>>::value == 1) );
+ VERIFY( (std::ratio_greater_equal<std::ratio<1,3>,
+ std::ratio<-1,3>>::value == 1) );
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
+ VERIFY( (std::ratio_greater_equal<std::ratio<-1,3>,
+ std::ratio<1,3>>::value == 0) );
+ VERIFY( (std::ratio_greater_equal<std::ratio<1,4>,
+ std::ratio<1,3>>::value == 0) );
+}
int main()
{
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
test01();
test02();
-#endif
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc b/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc
index 1d378d5..56052e4 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
// Copyright (C) 2008 Free Software Foundation
//
@@ -21,8 +22,6 @@
#include <ratio>
#include <testsuite_hooks.h>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
static const std::intmax_t M = INTMAX_MAX;
void
@@ -30,27 +29,23 @@ test01()
{
bool test __attribute__((unused)) = true;
- //no overflow with same denominator
- VERIFY(( std::ratio_less<std::ratio<M - 2, M>,
- std::ratio<M - 1, M>>::value == 1 ) );
+ // No overflow with same denominator
+ VERIFY( (std::ratio_less<std::ratio<M - 2, M>,
+ std::ratio<M - 1, M>>::value == 1) );
- VERIFY(( std::ratio_less<std::ratio<M - 1, M>,
- std::ratio<M - 2, M>>::value == 0 ) );
-
- //no overflow if signs differ
- VERIFY(( std::ratio_less<std::ratio<-M, M - 1>,
- std::ratio<M - 1, M - 2>>::value == 1 ) );
+ VERIFY( (std::ratio_less<std::ratio<M - 1, M>,
+ std::ratio<M - 2, M>>::value == 0) );
+
+ // No overflow if signs differ
+ VERIFY( (std::ratio_less<std::ratio<-M, M - 1>,
+ std::ratio<M - 1, M - 2>>::value == 1) );
- VERIFY(( std::ratio_less<std::ratio<M - 1, M - 2>,
- std::ratio<-M, M - 1>>::value == 0 ) );
+ VERIFY( (std::ratio_less<std::ratio<M - 1, M - 2>,
+ std::ratio<-M, M - 1>>::value == 0) );
}
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
-
int main()
{
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
test01();
-#endif
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons1.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons1.cc
index dc2f0da..8486069 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons1.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
// 2008-07-03 Chris Fairles <chris.fairles@gmail.com>
@@ -23,8 +24,6 @@
#include <ratio>
#include <testsuite_hooks.h>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
void
test01()
{
@@ -46,12 +45,8 @@ test01()
VERIFY( r3.den == r0.den );
}
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
-
int main()
{
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
test01();
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow.cc
index 05daee5..570ea6c 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow.cc
@@ -1,5 +1,6 @@
-// { dg-options "-std=gnu++0x" }
// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
// Copyright (C) 2008 Free Software Foundation
//
@@ -21,8 +22,6 @@
#include <ratio>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
void
test01()
{
@@ -48,11 +47,9 @@ test04()
std::ratio<1,0> r1;
}
-// { dg-error "instantiated from here" "" { target *-*-* } 36 }
-// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "instantiated from here" "" { target *-*-* } 48 }
+// { dg-error "instantiated from here" "" { target *-*-* } 35 }
+// { dg-error "instantiated from here" "" { target *-*-* } 41 }
+// { dg-error "instantiated from here" "" { target *-*-* } 47 }
// { dg-error "denominator cannot be zero" "" { target *-*-* } 150 }
// { dg-error "out of range" "" { target *-*-* } 151 }
// { dg-excess-errors "In instantiation of" }
-
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/ops1.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/ops1.cc
index 3f6a91d..b05092d 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops1.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
// 2008-07-03 Chris Fairles <chris.fairles@gmail.com>
@@ -23,8 +24,6 @@
#include <ratio>
#include <testsuite_hooks.h>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
void
test01()
{
@@ -32,8 +31,8 @@ test01()
std::ratio_add<std::ratio<3,8>, std::ratio<5,12>>::type r;
- VERIFY( r.num == 19);
- VERIFY( r.den == 24);
+ VERIFY( r.num == 19 );
+ VERIFY( r.den == 24 );
}
void
@@ -42,8 +41,8 @@ test02()
bool test __attribute__((unused)) = true;
std::ratio_subtract<std::ratio<3,8>, std::ratio<5,12>>::type r;
- VERIFY( r.num == -1);
- VERIFY( r.den == 24);
+ VERIFY( r.num == -1 );
+ VERIFY( r.den == 24 );
}
void
@@ -52,8 +51,8 @@ test03()
bool test __attribute__((unused)) = true;
std::ratio_multiply<std::ratio<3,8>, std::ratio<5,12>>::type r;
- VERIFY( r.num == 5);
- VERIFY( r.den == 32);
+ VERIFY( r.num == 5 );
+ VERIFY( r.den == 32 );
}
void
@@ -62,19 +61,15 @@ test04()
bool test __attribute__((unused)) = true;
std::ratio_divide<std::ratio<3,8>, std::ratio<5,12>>::type r;
- VERIFY( r.num == 9);
- VERIFY( r.den == 10);
+ VERIFY( r.num == 9 );
+ VERIFY( r.den == 10 );
}
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
-
int main()
{
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
test01();
test02();
test03();
test04();
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/ops2.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/ops2.cc
index 2dc2be6..3d3241f 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops2.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops2.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
// 2008-07-03 Chris Fairles <chris.fairles@gmail.com>
@@ -23,8 +24,6 @@
#include <ratio>
#include <testsuite_hooks.h>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
typedef std::ratio<1, INTMAX_MAX> one_over_max;
typedef std::ratio<2, INTMAX_MAX> two_over_max;
typedef std::ratio<INTMAX_MAX, 1> max_over_one;
@@ -44,8 +43,8 @@ test01()
std::ratio<INTMAX_MAX / 2, INTMAX_MAX / 2>,
std::ratio<INTMAX_MAX / 2 , INTMAX_MAX / 2 + 1>>::type r2;
- VERIFY( r2.num == INTMAX_MAX);
- VERIFY( r2.den == (INTMAX_MAX / 2) + 1);
+ VERIFY( r2.num == INTMAX_MAX );
+ VERIFY( r2.den == (INTMAX_MAX / 2) + 1 );
}
void
@@ -62,17 +61,13 @@ test02()
std::ratio<INTMAX_MAX / 2, INTMAX_MAX / 2>,
std::ratio<INTMAX_MAX / 2 , INTMAX_MAX / 2 + 1>>::type r2;
- VERIFY( r2.num == 1);
- VERIFY( r2.den == (INTMAX_MAX / 2) + 1);
+ VERIFY( r2.num == 1 );
+ VERIFY( r2.den == (INTMAX_MAX / 2) + 1 );
}
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
-
int main()
{
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
test01();
test02();
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/ops3.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/ops3.cc
index d66c37c..2008275 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops3.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops3.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
// 2008-07-03 Chris Fairles <chris.fairles@gmail.com>
@@ -23,8 +24,6 @@
#include <ratio>
#include <testsuite_hooks.h>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
void
test01()
{
@@ -34,15 +33,15 @@ test01()
std::ratio<2, INTMAX_MAX>,
std::ratio<INTMAX_MAX, 2>>::type r1;
- VERIFY( r1.num == 1);
- VERIFY( r1.den == 1);
+ VERIFY( r1.num == 1 );
+ VERIFY( r1.den == 1 );
std::ratio_multiply<
std::ratio<INTMAX_MAX, 2>,
std::ratio<2 , INTMAX_MAX - 1>>::type r2;
- VERIFY( r2.num == INTMAX_MAX);
- VERIFY( r2.den == INTMAX_MAX - 1);
+ VERIFY( r2.num == INTMAX_MAX );
+ VERIFY( r2.den == INTMAX_MAX - 1 );
}
void
@@ -54,24 +53,20 @@ test02()
std::ratio<INTMAX_MAX, 2>,
std::ratio<INTMAX_MAX, 2>>::type r1;
- VERIFY( r1.num == 1);
- VERIFY( r1.den == 1);
+ VERIFY( r1.num == 1 );
+ VERIFY( r1.den == 1 );
std::ratio_divide<
std::ratio<INTMAX_MAX-1, 2>,
std::ratio<INTMAX_MAX, 2>>::type r2;
- VERIFY( r2.num == INTMAX_MAX - 1);
- VERIFY( r2.den == INTMAX_MAX);
+ VERIFY( r2.num == INTMAX_MAX - 1 );
+ VERIFY( r2.den == INTMAX_MAX );
}
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
-
int main()
{
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
test01();
test02();
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow.cc
index 7dffda3..860f9f2 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow.cc
@@ -1,5 +1,6 @@
-// { dg-options "-std=gnu++0x" }
// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
// 2008-07-03 Chris Fairles <chris.fairles@gmail.com>
@@ -23,8 +24,6 @@
#include <ratio>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
void
test01()
{
@@ -38,14 +37,12 @@ test02()
std::ratio_multiply<std::ratio<INTMAX_MAX>, std::ratio<INTMAX_MAX>>::type r2;
}
-// { dg-error "instantiated from here" "" { target *-*-* } 31 }
+// { dg-error "instantiated from here" "" { target *-*-* } 30 }
+// { dg-error "instantiated from here" "" { target *-*-* } 36 }
// { dg-error "instantiated from here" "" { target *-*-* } 37 }
-// { dg-error "instantiated from here" "" { target *-*-* } 38 }
// { dg-error "overflow in addition" "" { target *-*-* } 127 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 95 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 97 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 99 }
// { dg-excess-errors "In instantiation of" }
// { dg-excess-errors "out of range" }
-
-#endif //_GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 327b691..e2d22ae 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -88,3 +88,12 @@ proc dg-require-rvalref { args } {
}
return
}
+
+proc dg-require-cstdint { args } {
+ if { ![ check_v3_target_cstdint ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index d6b372b..d8c168d 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1,6 +1,6 @@
# libstdc++ "tool init file" for DejaGNU
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -939,7 +939,7 @@ proc check_v3_target_debug_mode { } {
} else {
set et_debug_mode 0
- # Set up, compile, and execute a C++ test program that depends
+ # Set up and compile a C++ test program that depends
# on debug mode working.
set src debug_mode[pid].cc
set exe debug_mode[pid].exe
@@ -993,7 +993,7 @@ proc check_v3_target_parallel_mode { } {
} else {
set et_parallel_mode 0
- # Set up, compile, and execute a C++ test program that depends
+ # Set up and compile a C++ test program that depends
# on parallel mode working.
set src parallel_mode[pid].cc
set exe parallel_mode[pid].exe
@@ -1021,3 +1021,61 @@ proc check_v3_target_parallel_mode { } {
verbose "check_v3_target_parallel_mode: $et_parallel_mode" 2
return $et_parallel_mode
}
+
+proc check_v3_target_cstdint { } {
+ global cxxflags
+ global DEFAULT_CXXFLAGS
+ global et_cstdint
+
+ global tool
+
+ if { ![info exists et_cstdint_target_name] } {
+ set et_cstdint_target_name ""
+ }
+
+ # If the target has changed since we set the cached value, clear it.
+ set current_target [current_target_name]
+ if { $current_target != $et_cstdint_target_name } {
+ verbose "check_v3_target_cstdint: `$et_cstdint_target_name'" 2
+ set et_cstdint_target_name $current_target
+ if [info exists et_cstdint] {
+ verbose "check_v3_target_cstdint: removing cached result" 2
+ unset et_cstdint
+ }
+ }
+
+ if [info exists et_cstdint] {
+ verbose "check_v3_target_cstdint: using cached result" 2
+ } else {
+ set et_cstdint 0
+
+ # Set up and compile a C++0x test program that depends
+ # on the C99 stdint facilities to be available.
+ set src cstdint[pid].cc
+ set exe cstdint[pid].exe
+
+ set f [open $src "w"]
+ puts $f "#include <cstdint>"
+ puts $f "int main()"
+ puts $f "#ifdef _GLIBCXX_USE_C99_STDINT_TR1"
+ puts $f "{ return 0; }"
+ puts $f "#endif"
+ close $f
+
+ set cxxflags_saved $cxxflags
+ set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -std=gnu++0x -Werror"
+
+ set lines [v3_target_compile $src $exe executable ""]
+ set cxxflags $cxxflags_saved
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, compilation succeeded.
+ set et_cstdint 1
+ } else {
+ verbose "check_v3_target_cstdint: compilation failed" 2
+ }
+ }
+ verbose "check_v3_target_cstdint: $et_cstdint" 2
+ return $et_cstdint
+}