===================================================================
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 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
===================================================================
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 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
===================================================================
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2010-03-16 Paolo Carlini <paolo.carlini@oracle.com>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2010-2012 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
===================================================================
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2010-02-16 Paolo Carlini <paolo.carlini@oracle.com>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2010-2012 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
===================================================================
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 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
===================================================================
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 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
===================================================================
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 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
===================================================================
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2010-02-01 Paolo Carlini <paolo.carlini@oracle.com>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2010-2012 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
===================================================================
@@ -206,6 +206,15 @@
return
}
+proc dg-require-little-endian { args } {
+ if { ![ check_v3_target_little_endian ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
+
proc add_options_for_no_pch { flags } {
# This forces any generated and possibly included PCH to be invalid.
return "-D__GLIBCXX__=99999999"
===================================================================
@@ -1736,6 +1736,57 @@
return $et_static_libstdcxx
}
+proc check_v3_target_little_endian { } {
+ global cxxflags
+ global DEFAULT_CXXFLAGS
+ global et_little_endian
+ global tool
+ if { ![info exists et_little_endian_target_name] } {
+ set et_little_endian_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_little_endian_target_name } {
+ verbose "check_v3_target_little_endian: `$et_little_endian_target_name'" 2
+ set et_little_endian_target_name $current_target
+ if [info exists et_little_endian] {
+ verbose "check_v3_target_little_endian: removing cached result" 2
+ unset et_little_endian
+ }
+ }
+
+ if [info exists et_little_endian] {
+ verbose "check_v3_target_little_endian: using cached result" 2
+ } else {
+ set et_little_endian 0
+
+ set src little_endian[pid].cc
+
+ set f [open $src "w"]
+ puts $f "#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__"
+ puts $f "# error Not little endian"
+ puts $f "#endif"
+ close $f
+
+ set cxxflags_saved $cxxflags
+ set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ set cxxflags $cxxflags_saved
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocessing succeeded.
+ set et_little_endian 1
+ } else {
+ verbose "check_v3_target_little_endian: compilation failed" 2
+ }
+ }
+ verbose "check_v3_target_little_endian: $et_little_endian" 2
+ return $et_little_endian
+}
+
set additional_prunes ""
===================================================================
@@ -32,6 +32,8 @@
#pragma GCC system_header
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
#ifdef __SSE2__
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
@@ -133,4 +135,6 @@
#endif // __SSE2__
+#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
#endif // _EXT_OPT_RANDOM_H
===================================================================
@@ -47,6 +47,8 @@
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
/* Mersenne twister implementation optimized for vector operations.
*
* Reference: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/
@@ -380,6 +382,7 @@
0x3bd2b64bU, 0x0c64b1e4U>
sfmt216091_64;
+#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/**
* @brief A beta continuous distribution for random numbers.
===================================================================
@@ -37,6 +37,7 @@
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
@@ -402,6 +403,7 @@
return __is;
}
+#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/**
* Iteration method due to M.D. J<o:>hnk.