11b362b15af34006e6a11974088a46d42b903418eJohann// Copyright 2005, Google Inc.
21b362b15af34006e6a11974088a46d42b903418eJohann// All rights reserved.
31b362b15af34006e6a11974088a46d42b903418eJohann//
41b362b15af34006e6a11974088a46d42b903418eJohann// Redistribution and use in source and binary forms, with or without
51b362b15af34006e6a11974088a46d42b903418eJohann// modification, are permitted provided that the following conditions are
61b362b15af34006e6a11974088a46d42b903418eJohann// met:
71b362b15af34006e6a11974088a46d42b903418eJohann//
81b362b15af34006e6a11974088a46d42b903418eJohann//     * Redistributions of source code must retain the above copyright
91b362b15af34006e6a11974088a46d42b903418eJohann// notice, this list of conditions and the following disclaimer.
101b362b15af34006e6a11974088a46d42b903418eJohann//     * Redistributions in binary form must reproduce the above
111b362b15af34006e6a11974088a46d42b903418eJohann// copyright notice, this list of conditions and the following disclaimer
121b362b15af34006e6a11974088a46d42b903418eJohann// in the documentation and/or other materials provided with the
131b362b15af34006e6a11974088a46d42b903418eJohann// distribution.
141b362b15af34006e6a11974088a46d42b903418eJohann//     * Neither the name of Google Inc. nor the names of its
151b362b15af34006e6a11974088a46d42b903418eJohann// contributors may be used to endorse or promote products derived from
161b362b15af34006e6a11974088a46d42b903418eJohann// this software without specific prior written permission.
171b362b15af34006e6a11974088a46d42b903418eJohann//
181b362b15af34006e6a11974088a46d42b903418eJohann// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
191b362b15af34006e6a11974088a46d42b903418eJohann// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
201b362b15af34006e6a11974088a46d42b903418eJohann// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
211b362b15af34006e6a11974088a46d42b903418eJohann// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
221b362b15af34006e6a11974088a46d42b903418eJohann// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
231b362b15af34006e6a11974088a46d42b903418eJohann// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
241b362b15af34006e6a11974088a46d42b903418eJohann// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
251b362b15af34006e6a11974088a46d42b903418eJohann// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
261b362b15af34006e6a11974088a46d42b903418eJohann// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
271b362b15af34006e6a11974088a46d42b903418eJohann// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
281b362b15af34006e6a11974088a46d42b903418eJohann// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
291b362b15af34006e6a11974088a46d42b903418eJohann//
301b362b15af34006e6a11974088a46d42b903418eJohann// Author: wan@google.com (Zhanyong Wan)
311b362b15af34006e6a11974088a46d42b903418eJohann//
321b362b15af34006e6a11974088a46d42b903418eJohann// The Google C++ Testing Framework (Google Test)
331b362b15af34006e6a11974088a46d42b903418eJohann//
341b362b15af34006e6a11974088a46d42b903418eJohann// This header file defines the public API for Google Test.  It should be
351b362b15af34006e6a11974088a46d42b903418eJohann// included by any test program that uses Google Test.
361b362b15af34006e6a11974088a46d42b903418eJohann//
371b362b15af34006e6a11974088a46d42b903418eJohann// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
381b362b15af34006e6a11974088a46d42b903418eJohann// leave some internal implementation details in this header file.
391b362b15af34006e6a11974088a46d42b903418eJohann// They are clearly marked by comments like this:
401b362b15af34006e6a11974088a46d42b903418eJohann//
411b362b15af34006e6a11974088a46d42b903418eJohann//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
421b362b15af34006e6a11974088a46d42b903418eJohann//
431b362b15af34006e6a11974088a46d42b903418eJohann// Such code is NOT meant to be used by a user directly, and is subject
441b362b15af34006e6a11974088a46d42b903418eJohann// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
451b362b15af34006e6a11974088a46d42b903418eJohann// program!
461b362b15af34006e6a11974088a46d42b903418eJohann//
471b362b15af34006e6a11974088a46d42b903418eJohann// Acknowledgment: Google Test borrowed the idea of automatic test
481b362b15af34006e6a11974088a46d42b903418eJohann// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
491b362b15af34006e6a11974088a46d42b903418eJohann// easyUnit framework.
501b362b15af34006e6a11974088a46d42b903418eJohann
511b362b15af34006e6a11974088a46d42b903418eJohann#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
521b362b15af34006e6a11974088a46d42b903418eJohann#define GTEST_INCLUDE_GTEST_GTEST_H_
531b362b15af34006e6a11974088a46d42b903418eJohann
541b362b15af34006e6a11974088a46d42b903418eJohann#include <limits>
555ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <ostream>
561b362b15af34006e6a11974088a46d42b903418eJohann#include <vector>
571b362b15af34006e6a11974088a46d42b903418eJohann
585ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Copyright 2005, Google Inc.
595ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// All rights reserved.
605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
615ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Redistribution and use in source and binary forms, with or without
625ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// modification, are permitted provided that the following conditions are
635ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// met:
645ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
655ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Redistributions of source code must retain the above copyright
665ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// notice, this list of conditions and the following disclaimer.
675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Redistributions in binary form must reproduce the above
685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// copyright notice, this list of conditions and the following disclaimer
695ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// in the documentation and/or other materials provided with the
705ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// distribution.
715ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Neither the name of Google Inc. nor the names of its
725ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// contributors may be used to endorse or promote products derived from
735ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// this software without specific prior written permission.
745ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
755ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
765ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
775ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
785ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
795ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
805ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
815ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
825ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
835ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
845ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
855ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
865ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
875ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
885ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
895ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The Google C++ Testing Framework (Google Test)
905ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
915ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// This header file declares functions and macros used internally by
925ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Google Test.  They are subject to change without notice.
935ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
945ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
955ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
965ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
975ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Copyright 2005, Google Inc.
985ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// All rights reserved.
995ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
1005ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Redistribution and use in source and binary forms, with or without
1015ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// modification, are permitted provided that the following conditions are
1025ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// met:
1035ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
1045ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Redistributions of source code must retain the above copyright
1055ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// notice, this list of conditions and the following disclaimer.
1065ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Redistributions in binary form must reproduce the above
1075ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// copyright notice, this list of conditions and the following disclaimer
1085ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// in the documentation and/or other materials provided with the
1095ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// distribution.
1105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Neither the name of Google Inc. nor the names of its
1115ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// contributors may be used to endorse or promote products derived from
1125ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// this software without specific prior written permission.
1135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
1145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1185ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1195ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1215ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1225ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1235ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1245ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
1265ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Authors: wan@google.com (Zhanyong Wan)
1275ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
1285ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Low-level types and utilities for porting Google Test to various
1295ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// platforms.  They are subject to change without notice.  DO NOT USE
1305ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// THEM IN USER CODE.
1315ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
1325ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// This file is fundamental to Google Test.  All other Google Test source
1335ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// files are expected to #include this.  Therefore, it cannot #include
1345ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// any other Google Test header.
1355ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
1365ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
1375ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
1385ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
1395ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user can define the following macros in the build script to
1405ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// control Google Test's behavior.  If the user doesn't define a macro
1415ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// in this list, Google Test will define it.
1425ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
1435ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
1445ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              is/isn't available.
1455ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
1465ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              are enabled.
1475ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
1485ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              is/isn't available (some systems define
1495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              ::string, which is different to std::string).
1505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
1515ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              is/isn't available (some systems define
1525ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              ::wstring, which is different to std::wstring).
1535ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular
1545ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              expressions are/aren't available.
1555ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
1565ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              is/isn't available.
1575ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
1585ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              enabled.
1595ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
1605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              std::wstring does/doesn't work (Google Test can
1615ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              be used where std::wstring is unavailable).
1625ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
1635ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              is/isn't available.
1645ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
1655ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              compiler supports Microsoft's "Structured
1665ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              Exception Handling".
1675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_STREAM_REDIRECTION
1685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                            - Define it to 1/0 to indicate whether the
1695ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              platform supports I/O stream redirection using
1705ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              dup() and dup2().
1715ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
1725ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              Test's own tr1 tuple implementation should be
1735ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              used.  Unused when the user sets
1745ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              GTEST_HAS_TR1_TUPLE to 0.
1755ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_LANG_CXX11         - Define it to 1/0 to indicate that Google Test
1765ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              is building in C++11/C++98 mode.
1775ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_LINKED_AS_SHARED_LIBRARY
1785ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                            - Define to 1 when compiling tests that use
1795ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              Google Test as a shared library (known as
1805ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              DLL on Windows).
1815ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_CREATE_SHARED_LIBRARY
1825ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                            - Define to 1 when compiling Google Test itself
1835ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              as a shared library.
1845ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
1855ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// This header defines the following utilities:
1865ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
1875ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Macros indicating the current platform (defined to 1 if compiled on
1885ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// the given platform; otherwise undefined):
1895ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_AIX      - IBM AIX
1905ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_CYGWIN   - Cygwin
1915ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_HPUX     - HP-UX
1925ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_LINUX    - Linux
1935ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     GTEST_OS_LINUX_ANDROID - Google Android
1945ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_MAC      - Mac OS X
1955ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     GTEST_OS_IOS    - iOS
1965ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//       GTEST_OS_IOS_SIMULATOR - iOS simulator
1975ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_NACL     - Google Native Client (NaCl)
1985ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_OPENBSD  - OpenBSD
1995ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_QNX      - QNX
2005ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_SOLARIS  - Sun Solaris
2015ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_SYMBIAN  - Symbian
2025ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
2035ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
2045ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     GTEST_OS_WINDOWS_MINGW    - MinGW
2055ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile
2065ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_OS_ZOS      - z/OS
2075ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2085ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
2095ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// most stable support.  Since core members of the Google Test project
2105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// don't have access to other platforms, support for them may be less
2115ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// stable.  If you notice any problems on your platform, please notify
2125ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// googletestframework@googlegroups.com (patches for fixing them are
2135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// even more welcome!).
2145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Note that it is possible that none of the GTEST_OS_* macros are defined.
2165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Macros indicating available Google Test features (defined to 1 if
2185ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// the corresponding feature is supported; otherwise undefined):
2195ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
2205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                            tests)
2215ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_DEATH_TEST   - death tests
2225ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_PARAM_TEST   - value-parameterized tests
2235ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_TYPED_TEST   - typed tests
2245ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
2255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with
2265ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                            GTEST_HAS_POSIX_RE (see above) which users can
2275ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                            define themselves.
2285ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
2295ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                            the above two are mutually exclusive.
2305ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
2315ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2325ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Macros for basic C++ coding:
2335ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
2345ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a
2355ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                              variable don't have to be used.
2365ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_DISALLOW_ASSIGN_   - disables operator=.
2375ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
2385ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
2395ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2405ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Synchronization:
2415ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   Mutex, MutexLock, ThreadLocal, GetThreadCount()
2425ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                  - synchronization primitives.
2435ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
2445ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                         synchronization primitives have real implementations
2455ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                         and Google Test is thread-safe; or 0 otherwise.
2465ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2475ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Template meta programming:
2485ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
2495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   IteratorTraits - partial implementation of std::iterator_traits, which
2505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                    is not available in libCstd when compiled with Sun C++.
2515ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2525ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Smart pointers:
2535ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   scoped_ptr     - as in TR2.
2545ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2555ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Regular expressions:
2565ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   RE             - a simple regular expression class using the POSIX
2575ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                    Extended Regular Expression syntax on UNIX-like
2585ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                    platforms, or a reduced regular exception syntax on
2595ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                    other platforms, including Windows.
2605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2615ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Logging:
2625ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_LOG_()   - logs messages at the specified severity level.
2635ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   LogToStderr()  - directs all log messages to stderr.
2645ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   FlushInfoLog() - flushes informational log messages.
2655ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2665ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Stdout and stderr capturing:
2675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   CaptureStdout()     - starts capturing stdout.
2685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GetCapturedStdout() - stops capturing stdout and returns the captured
2695ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                         string.
2705ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   CaptureStderr()     - starts capturing stderr.
2715ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GetCapturedStderr() - stops capturing stderr and returns the captured
2725ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                         string.
2735ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2745ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Integer types:
2755ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   TypeWithSize   - maps an integer to a int type.
2765ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   Int32, UInt32, Int64, UInt64, TimeInMillis
2775ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//                  - integers of known sizes.
2785ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   BiggestInt     - the biggest signed integer type.
2795ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2805ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Command-line utilities:
2815ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_FLAG()       - references a flag.
2825ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_DECLARE_*()  - declares a flag.
2835ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GTEST_DEFINE_*()   - defines a flag.
2845ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GetInjectableArgvs() - returns the command line as a vector of strings.
2855ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
2865ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Environment variable utilities:
2875ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   GetEnv()             - gets the value of an environment variable.
2885ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   BoolFromGTestEnv()   - parses a bool environment variable.
2895ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   Int32FromGTestEnv()  - parses an Int32 environment variable.
2905ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   StringFromGTestEnv() - parses a string environment variable.
2915ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
2925ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <ctype.h>   // for isspace, etc
2935ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <stddef.h>  // for ptrdiff_t
2945ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <stdlib.h>
2955ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <stdio.h>
2965ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <string.h>
2975ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef _WIN32_WCE
2985ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <sys/types.h>
2995ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <sys/stat.h>
3005ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // !_WIN32_WCE
3015ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
3025ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if defined __APPLE__
3035ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <AvailabilityMacros.h>
3045ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <TargetConditionals.h>
3055ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif
3065ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
3075ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <iostream>  // NOLINT
3085ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <sstream>  // NOLINT
3095ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <string>  // NOLINT
3105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
3115ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
3125ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_FLAG_PREFIX_ "gtest_"
3135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
3145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
3155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_NAME_ "Google Test"
3165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
3175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
3185ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Determines the version of gcc that is used to compile this.
3195ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifdef __GNUC__
3205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// 40302 means version 4.3.2.
3215ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_GCC_VER_ \
3225ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
3235ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // __GNUC__
3245ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
3255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Determines the platform on which Google Test is compiled.
3265ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifdef __CYGWIN__
3275ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_CYGWIN 1
3285ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined __SYMBIAN32__
3295ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_SYMBIAN 1
3305ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined _WIN32
3315ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_WINDOWS 1
3325ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# ifdef _WIN32_WCE
3335ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_OS_WINDOWS_MOBILE 1
3345ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# elif defined(__MINGW__) || defined(__MINGW32__)
3355ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_OS_WINDOWS_MINGW 1
3365ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# else
3375ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_OS_WINDOWS_DESKTOP 1
3385ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif  // _WIN32_WCE
3395ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined __APPLE__
3405ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_MAC 1
3415ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if TARGET_OS_IPHONE
3425ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_OS_IOS 1
3435ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  if TARGET_IPHONE_SIMULATOR
3445ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   define GTEST_OS_IOS_SIMULATOR 1
3455ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  endif
3465ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif
3475ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined __linux__
3485ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_LINUX 1
3495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if defined __ANDROID__
3505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_OS_LINUX_ANDROID 1
3515ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif
3525ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined __MVS__
3535ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_ZOS 1
3545ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined(__sun) && defined(__SVR4)
3555ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_SOLARIS 1
3565ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined(_AIX)
3575ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_AIX 1
3585ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined(__hpux)
3595ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_HPUX 1
3605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined __native_client__
3615ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_NACL 1
3625ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined __OpenBSD__
3635ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_OPENBSD 1
3645ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif defined __QNX__
3655ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_OS_QNX 1
3665ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // __CYGWIN__
3675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
3685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_LANG_CXX11
3695ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
3705ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a
3715ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// value for __cplusplus, and recent versions of clang, gcc, and
3725ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// probably other compilers set that too in C++11 mode.
3735ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
3745ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Compiling in at least C++11 mode.
3755ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_LANG_CXX11 1
3765ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# else
3775ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_LANG_CXX11 0
3785ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif
3795ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif
3805ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
3815ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Brings in definitions for functions used in the testing::internal::posix
3825ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// namespace (read, write, close, chdir, isatty, stat). We do not currently
3835ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// use them on Windows Mobile.
3845ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if !GTEST_OS_WINDOWS
3855ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// This assumes that non-Windows OSes provide unistd.h. For OSes where this
3865ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// is not the case, we need to include headers that provide the functions
3875ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// mentioned above.
3885ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <unistd.h>
3895ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <strings.h>
3905ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif !GTEST_OS_WINDOWS_MOBILE
3915ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <direct.h>
3925ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <io.h>
3935ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif
3945ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
3955ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if GTEST_OS_LINUX_ANDROID
3965ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Used to define __ANDROID_API__ matching the target NDK API level.
3975ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  include <android/api-level.h>  // NOLINT
3985ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif
3995ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4005ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Defines this to true iff Google Test can use POSIX regular expressions.
4015ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_HAS_POSIX_RE
4025ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if GTEST_OS_LINUX_ANDROID
4035ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// On Android, <regex.h> is only available starting with Gingerbread.
4045ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
4055ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# else
4065ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
4075ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif
4085ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif
4095ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if GTEST_HAS_POSIX_RE
4115ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4125ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// On some platforms, <regex.h> needs someone to define size_t, and
4135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// won't compile otherwise.  We can #include it here as we already
4145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// included <stdlib.h>, which is guaranteed to define size_t through
4155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// <stddef.h>.
4165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <regex.h>  // NOLINT
4175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4185ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_USES_POSIX_RE 1
4195ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif GTEST_OS_WINDOWS
4215ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4225ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// <regex.h> is not available on Windows.  Use our own simple regex
4235ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// implementation instead.
4245ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_USES_SIMPLE_RE 1
4255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4265ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#else
4275ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4285ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// <regex.h> may not be available on this platform.  Use our own
4295ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// simple regex implementation instead.
4305ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_USES_SIMPLE_RE 1
4315ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4325ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_HAS_POSIX_RE
4335ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4345ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_HAS_EXCEPTIONS
4355ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user didn't tell us whether exceptions are enabled, so we need
4365ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// to figure it out.
4375ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if defined(_MSC_VER) || defined(__BORLANDC__)
4385ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
4395ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// macro to enable exceptions, so we'll do the same.
4405ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Assumes that exceptions are enabled by default.
4415ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  ifndef _HAS_EXCEPTIONS
4425ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   define _HAS_EXCEPTIONS 1
4435ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  endif  // _HAS_EXCEPTIONS
4445ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
4455ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# elif defined(__GNUC__) && __EXCEPTIONS
4465ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
4475ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_EXCEPTIONS 1
4485ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# elif defined(__SUNPRO_CC)
4495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Sun Pro CC supports exceptions.  However, there is no compile-time way of
4505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// detecting whether they are enabled or not.  Therefore, we assume that
4515ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// they are enabled unless the user tells us otherwise.
4525ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_EXCEPTIONS 1
4535ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# elif defined(__IBMCPP__) && __EXCEPTIONS
4545ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
4555ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_EXCEPTIONS 1
4565ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# elif defined(__HP_aCC)
4575ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Exception handling is in effect by default in HP aCC compiler. It has to
4585ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// be turned of by +noeh compiler option if desired.
4595ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_EXCEPTIONS 1
4605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# else
4615ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// For other compilers, we assume exceptions are disabled to be
4625ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// conservative.
4635ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_EXCEPTIONS 0
4645ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif  // defined(_MSC_VER) || defined(__BORLANDC__)
4655ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_HAS_EXCEPTIONS
4665ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if !defined(GTEST_HAS_STD_STRING)
4685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Even though we don't use this macro any longer, we keep it in case
4695ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// some clients still depend on it.
4705ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_HAS_STD_STRING 1
4715ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#elif !GTEST_HAS_STD_STRING
4725ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user told us that ::std::string isn't available.
4735ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# error "Google Test cannot be used where ::std::string isn't available."
4745ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // !defined(GTEST_HAS_STD_STRING)
4755ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4765ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_HAS_GLOBAL_STRING
4775ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user didn't tell us whether ::string is available, so we need
4785ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// to figure it out.
4795ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4805ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_HAS_GLOBAL_STRING 0
4815ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4825ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_HAS_GLOBAL_STRING
4835ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4845ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_HAS_STD_WSTRING
4855ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user didn't tell us whether ::std::wstring is available, so we need
4865ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// to figure it out.
4875ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
4885ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//   is available.
4895ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4905ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Cygwin 1.7 and below doesn't support ::std::wstring.
4915ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Solaris' libc++ doesn't support it either.  Android has
4925ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// no support for it at least as recent as Froyo (2.2).
4935ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_HAS_STD_WSTRING \
4945ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
4955ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4965ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_HAS_STD_WSTRING
4975ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
4985ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_HAS_GLOBAL_WSTRING
4995ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user didn't tell us whether ::wstring is available, so we need
5005ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// to figure it out.
5015ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_HAS_GLOBAL_WSTRING \
5025ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
5035ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_HAS_GLOBAL_WSTRING
5045ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5055ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Determines whether RTTI is available.
5065ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_HAS_RTTI
5075ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user didn't tell us whether RTTI is enabled, so we need to
5085ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// figure it out.
5095ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# ifdef _MSC_VER
5115ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5125ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.
5135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   define GTEST_HAS_RTTI 1
5145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  else
5155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   define GTEST_HAS_RTTI 0
5165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  endif
5175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5185ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
5195ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
5205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5215ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  ifdef __GXX_RTTI
5225ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// When building against STLport with the Android NDK and with
5235ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// -frtti -fno-exceptions, the build fails at link time with undefined
5245ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
5255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// so disable RTTI when detected.
5265ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
5275ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang       !defined(__EXCEPTIONS)
5285ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#    define GTEST_HAS_RTTI 0
5295ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   else
5305ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#    define GTEST_HAS_RTTI 1
5315ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   endif  // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
5325ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  else
5335ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   define GTEST_HAS_RTTI 0
5345ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  endif  // __GXX_RTTI
5355ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5365ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
5375ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
5385ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// first version with C++ support.
5395ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# elif defined(__clang__)
5405ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5415ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_RTTI __has_feature(cxx_rtti)
5425ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5435ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
5445ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// both the typeid and dynamic_cast features are present.
5455ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
5465ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5475ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  ifdef __RTTI_ALL__
5485ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   define GTEST_HAS_RTTI 1
5495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  else
5505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#   define GTEST_HAS_RTTI 0
5515ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  endif
5525ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5535ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# else
5545ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5555ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// For all other compilers, we assume RTTI is enabled.
5565ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_RTTI 1
5575ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5585ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif  // _MSC_VER
5595ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_HAS_RTTI
5615ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5625ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// It's this header's responsibility to #include <typeinfo> when RTTI
5635ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// is enabled.
5645ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if GTEST_HAS_RTTI
5655ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <typeinfo>
5665ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif
5675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Determines whether Google Test can use the pthreads library.
5695ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_HAS_PTHREAD
5705ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user didn't tell us explicitly, so we assume pthreads support is
5715ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// available on Linux and Mac.
5725ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
5735ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
5745ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// to your compiler flags.
5755ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
5765ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    || GTEST_OS_QNX)
5775ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_HAS_PTHREAD
5785ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5795ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if GTEST_HAS_PTHREAD
5805ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
5815ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// true.
5825ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <pthread.h>  // NOLINT
5835ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5845ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// For timespec and nanosleep, used below.
5855ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# include <time.h>  // NOLINT
5865ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif
5875ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
5885ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Determines whether Google Test can use tr1/tuple.  You can define
5895ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// this macro to 0 to prevent Google Test from using tuple (any
5905ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// feature depending on tuple with be disabled in this mode).
5915ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_HAS_TR1_TUPLE
5925ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
5935ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
5945ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_TR1_TUPLE 0
5955ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# else
5965ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user didn't tell us not to do it, so we assume it's OK.
5975ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_HAS_TR1_TUPLE 1
5985ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif
5995ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_HAS_TR1_TUPLE
6005ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6015ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Determines whether Google Test's own tr1 tuple implementation
6025ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// should be used.
6035ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_USE_OWN_TR1_TUPLE
6045ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The user didn't tell us, so we need to figure it out.
6055ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6065ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// We use our own TR1 tuple if we aren't sure the user has an
6075ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// implementation of it already.  At this time, libstdc++ 4.0.0+ and
6085ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// MSVC 2010 are the only mainstream standard libraries that come
6095ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// with a TR1 tuple implementation.  NVIDIA's CUDA NVCC compiler
6105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// pretends to be GCC by defining __GNUC__ and friends, but cannot
6115ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// compile GCC's tuple implementation.  MSVC 2008 (9.0) provides TR1
6125ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// tuple in a 323 MB Feature Pack download, which we cannot assume the
6135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// user has.  QNX's QCC compiler is a modified GCC but it doesn't
6145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// support TR1 tuple.  libc++ only provides std::tuple, in C++11 mode,
6155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// and it can be used with some compilers that define __GNUC__.
6165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
6175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang      && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
6185ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_ENV_HAS_TR1_TUPLE_ 1
6195ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif
6205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6215ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
6225ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
6235ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// can build with clang but need to use gcc4.2's libstdc++).
6245ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
6255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_ENV_HAS_STD_TUPLE_ 1
6265ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif
6275ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6285ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
6295ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_USE_OWN_TR1_TUPLE 0
6305ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# else
6315ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#  define GTEST_USE_OWN_TR1_TUPLE 1
6325ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# endif
6335ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6345ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif  // GTEST_USE_OWN_TR1_TUPLE
6355ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6365ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// To avoid conditional compilation everywhere, we make it
6375ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// gtest-port.h's responsibility to #include the header implementing
6385ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// tr1/tuple.
6395ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if GTEST_HAS_TR1_TUPLE
6405ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6415ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# if GTEST_USE_OWN_TR1_TUPLE
6425ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// This file was GENERATED by command:
6435ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     pump.py gtest-tuple.h.pump
6445ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// DO NOT EDIT BY HAND!!!
6455ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6465ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Copyright 2009 Google Inc.
6475ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// All Rights Reserved.
6485ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
6495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Redistribution and use in source and binary forms, with or without
6505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// modification, are permitted provided that the following conditions are
6515ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// met:
6525ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
6535ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Redistributions of source code must retain the above copyright
6545ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// notice, this list of conditions and the following disclaimer.
6555ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Redistributions in binary form must reproduce the above
6565ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// copyright notice, this list of conditions and the following disclaimer
6575ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// in the documentation and/or other materials provided with the
6585ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// distribution.
6595ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//     * Neither the name of Google Inc. nor the names of its
6605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// contributors may be used to endorse or promote products derived from
6615ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// this software without specific prior written permission.
6625ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
6635ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6645ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6655ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6665ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
6675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
6685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
6695ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
6705ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
6715ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6725ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6735ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6745ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang//
6755ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Author: wan@google.com (Zhanyong Wan)
6765ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6775ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
6785ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6795ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
6805ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
6815ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6825ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <utility>  // For ::std::pair.
6835ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6845ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// The compiler used in Symbian has a bug that prevents us from declaring the
6855ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// tuple template as a friend (it complains that tuple is redefined).  This
6865ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// hack bypasses the bug by declaring the members that should otherwise be
6875ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// private as public.
6885ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Sun Studio versions < 12 also have the above bug.
6895ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
6905ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
6915ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#else
6925ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
6935ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
6945ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang   private:
6955ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif
6965ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
6975ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// GTEST_n_TUPLE_(T) is the type of an n-tuple.
6985ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_0_TUPLE_(T) tuple<>
6995ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
7005ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    void, void, void>
7015ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
7025ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    void, void, void>
7035ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
7045ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    void, void, void>
7055ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
7065ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    void, void, void>
7075ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
7085ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    void, void, void>
7095ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
7105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    void, void, void>
7115ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
7125ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    void, void, void>
7135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
7145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    T##7, void, void>
7155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
7165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    T##7, T##8, void>
7175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
7185ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    T##7, T##8, T##9>
7195ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
7215ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_0_TYPENAMES_(T)
7225ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_1_TYPENAMES_(T) typename T##0
7235ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
7245ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
7255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7265ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##3
7275ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7285ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##3, typename T##4
7295ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7305ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##3, typename T##4, typename T##5
7315ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7325ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##3, typename T##4, typename T##5, typename T##6
7335ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7345ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
7355ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7365ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##3, typename T##4, typename T##5, typename T##6, \
7375ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##7, typename T##8
7385ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7395ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##3, typename T##4, typename T##5, typename T##6, \
7405ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T##7, typename T##8, typename T##9
7415ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7425ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// In theory, defining stuff in the ::std namespace is undefined
7435ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// behavior.  We can do this as we are playing the role of a standard
7445ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// library vendor.
7455ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangnamespace std {
7465ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangnamespace tr1 {
7475ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7485ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <typename T0 = void, typename T1 = void, typename T2 = void,
7495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T3 = void, typename T4 = void, typename T5 = void,
7505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T6 = void, typename T7 = void, typename T8 = void,
7515ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang    typename T9 = void>
7525ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangclass tuple;
7535ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7545ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// Anything in namespace gtest_internal is Google Test's INTERNAL
7555ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
7565ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangnamespace gtest_internal {
7575ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7585ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
7595ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <typename T>
7605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct ByRef { typedef const T& type; };  // NOLINT
7615ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <typename T>
7625ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct ByRef<T&> { typedef T& type; };  // NOLINT
7635ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7645ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// A handy wrapper for ByRef.
7655ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
7665ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// AddRef<T>::type is T if T is a reference; otherwise it's T&.  This
7685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// is the same as tr1::add_reference<T>::type.
7695ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <typename T>
7705ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct AddRef { typedef T& type; };  // NOLINT
7715ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <typename T>
7725ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct AddRef<T&> { typedef T& type; };  // NOLINT
7735ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7745ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// A handy wrapper for AddRef.
7755ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
7765ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7775ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// A helper for implementing get<k>().
7785ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <int k> class Get;
7795ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7805ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// A helper for implementing tuple_element<k, T>.  kIndexValid is true
7815ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang// iff k < the number of fields in tuple type T.
7825ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <bool kIndexValid, int kIndex, class Tuple>
7835ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement;
7845ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7855ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
7865ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
7875ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang  typedef T0 type;
7885ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang};
7895ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7905ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
7915ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
7925ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang  typedef T1 type;
7935ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang};
7945ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
7955ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
7965ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
7975ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang  typedef T2 type;
7985ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang};
7995ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
8005ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
8015ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
8025ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang  typedef T3 type;
8035ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang};
8045ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
8055ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
8065ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
8075ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang  typedef T4 type;
8085ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang};
8095ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
8105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
8115ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
8125ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang  typedef T5 type;
8135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang};
8145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
8155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
8165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
8175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang  typedef T6 type;
8185ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang};
8195ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
8205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
8215ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangstruct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
8225ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang  typedef T7 type;
8235ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang};
8245ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang
8255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangtemplate <GTEST_10_TYPENAMES_(T)>
826