113481Sgiacomo.travaglini@arm.com// Copyright 2008, Google Inc.
213481Sgiacomo.travaglini@arm.com// All rights reserved.
313481Sgiacomo.travaglini@arm.com//
413481Sgiacomo.travaglini@arm.com// Redistribution and use in source and binary forms, with or without
513481Sgiacomo.travaglini@arm.com// modification, are permitted provided that the following conditions are
613481Sgiacomo.travaglini@arm.com// met:
713481Sgiacomo.travaglini@arm.com//
813481Sgiacomo.travaglini@arm.com//     * Redistributions of source code must retain the above copyright
913481Sgiacomo.travaglini@arm.com// notice, this list of conditions and the following disclaimer.
1013481Sgiacomo.travaglini@arm.com//     * Redistributions in binary form must reproduce the above
1113481Sgiacomo.travaglini@arm.com// copyright notice, this list of conditions and the following disclaimer
1213481Sgiacomo.travaglini@arm.com// in the documentation and/or other materials provided with the
1313481Sgiacomo.travaglini@arm.com// distribution.
1413481Sgiacomo.travaglini@arm.com//     * Neither the name of Google Inc. nor the names of its
1513481Sgiacomo.travaglini@arm.com// contributors may be used to endorse or promote products derived from
1613481Sgiacomo.travaglini@arm.com// this software without specific prior written permission.
1713481Sgiacomo.travaglini@arm.com//
1813481Sgiacomo.travaglini@arm.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1913481Sgiacomo.travaglini@arm.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2013481Sgiacomo.travaglini@arm.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2113481Sgiacomo.travaglini@arm.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2213481Sgiacomo.travaglini@arm.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2313481Sgiacomo.travaglini@arm.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2413481Sgiacomo.travaglini@arm.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2513481Sgiacomo.travaglini@arm.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2613481Sgiacomo.travaglini@arm.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2713481Sgiacomo.travaglini@arm.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2813481Sgiacomo.travaglini@arm.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2913481Sgiacomo.travaglini@arm.com//
3013481Sgiacomo.travaglini@arm.com// Author: vadimb@google.com (Vadim Berman)
3113481Sgiacomo.travaglini@arm.com//
3213481Sgiacomo.travaglini@arm.com// Low-level types and utilities for porting Google Mock to various
3313481Sgiacomo.travaglini@arm.com// platforms.  All macros ending with _ and symbols defined in an
3413481Sgiacomo.travaglini@arm.com// internal namespace are subject to change without notice.  Code
3513481Sgiacomo.travaglini@arm.com// outside Google Mock MUST NOT USE THEM DIRECTLY.  Macros that don't
3613481Sgiacomo.travaglini@arm.com// end with _ are part of Google Mock's public API and can be used by
3713481Sgiacomo.travaglini@arm.com// code outside Google Mock.
3813481Sgiacomo.travaglini@arm.com
3913481Sgiacomo.travaglini@arm.com#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
4013481Sgiacomo.travaglini@arm.com#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
4113481Sgiacomo.travaglini@arm.com
4213481Sgiacomo.travaglini@arm.com#include <assert.h>
4313481Sgiacomo.travaglini@arm.com#include <stdlib.h>
4413481Sgiacomo.travaglini@arm.com#include <iostream>
4513481Sgiacomo.travaglini@arm.com
4613481Sgiacomo.travaglini@arm.com// Most of the utilities needed for porting Google Mock are also
4713481Sgiacomo.travaglini@arm.com// required for Google Test and are defined in gtest-port.h.
4813481Sgiacomo.travaglini@arm.com//
4913481Sgiacomo.travaglini@arm.com// Note to maintainers: to reduce code duplication, prefer adding
5013481Sgiacomo.travaglini@arm.com// portability utilities to Google Test's gtest-port.h instead of
5113481Sgiacomo.travaglini@arm.com// here, as Google Mock depends on Google Test.  Only add a utility
5213481Sgiacomo.travaglini@arm.com// here if it's truly specific to Google Mock.
5313481Sgiacomo.travaglini@arm.com#include "gtest/internal/gtest-linked_ptr.h"
5413481Sgiacomo.travaglini@arm.com#include "gtest/internal/gtest-port.h"
5513481Sgiacomo.travaglini@arm.com#include "gmock/internal/custom/gmock-port.h"
5613481Sgiacomo.travaglini@arm.com
5713481Sgiacomo.travaglini@arm.com// To avoid conditional compilation everywhere, we make it
5813481Sgiacomo.travaglini@arm.com// gmock-port.h's responsibility to #include the header implementing
5913481Sgiacomo.travaglini@arm.com// tr1/tuple.  gmock-port.h does this via gtest-port.h, which is
6013481Sgiacomo.travaglini@arm.com// guaranteed to pull in the tuple header.
6113481Sgiacomo.travaglini@arm.com
6213481Sgiacomo.travaglini@arm.com// For MS Visual C++, check the compiler version. At least VS 2003 is
6313481Sgiacomo.travaglini@arm.com// required to compile Google Mock.
6413481Sgiacomo.travaglini@arm.com#if defined(_MSC_VER) && _MSC_VER < 1310
6513481Sgiacomo.travaglini@arm.com# error "At least Visual C++ 2003 (7.1) is required to compile Google Mock."
6613481Sgiacomo.travaglini@arm.com#endif
6713481Sgiacomo.travaglini@arm.com
6813481Sgiacomo.travaglini@arm.com// Macro for referencing flags.  This is public as we want the user to
6913481Sgiacomo.travaglini@arm.com// use this syntax to reference Google Mock flags.
7013481Sgiacomo.travaglini@arm.com#define GMOCK_FLAG(name) FLAGS_gmock_##name
7113481Sgiacomo.travaglini@arm.com
7213481Sgiacomo.travaglini@arm.com#if !defined(GMOCK_DECLARE_bool_)
7313481Sgiacomo.travaglini@arm.com
7413481Sgiacomo.travaglini@arm.com// Macros for declaring flags.
7513481Sgiacomo.travaglini@arm.com#define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name)
7613481Sgiacomo.travaglini@arm.com#define GMOCK_DECLARE_int32_(name) \
7713481Sgiacomo.travaglini@arm.com    extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name)
7813481Sgiacomo.travaglini@arm.com#define GMOCK_DECLARE_string_(name) \
7913481Sgiacomo.travaglini@arm.com    extern GTEST_API_ ::std::string GMOCK_FLAG(name)
8013481Sgiacomo.travaglini@arm.com
8113481Sgiacomo.travaglini@arm.com// Macros for defining flags.
8213481Sgiacomo.travaglini@arm.com#define GMOCK_DEFINE_bool_(name, default_val, doc) \
8313481Sgiacomo.travaglini@arm.com    GTEST_API_ bool GMOCK_FLAG(name) = (default_val)
8413481Sgiacomo.travaglini@arm.com#define GMOCK_DEFINE_int32_(name, default_val, doc) \
8513481Sgiacomo.travaglini@arm.com    GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
8613481Sgiacomo.travaglini@arm.com#define GMOCK_DEFINE_string_(name, default_val, doc) \
8713481Sgiacomo.travaglini@arm.com    GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val)
8813481Sgiacomo.travaglini@arm.com
8913481Sgiacomo.travaglini@arm.com#endif  // !defined(GMOCK_DECLARE_bool_)
9013481Sgiacomo.travaglini@arm.com
9113481Sgiacomo.travaglini@arm.com#endif  // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
92