blob: b644eb4f6866bd0dc2b96f90d8a8013ecdef1a4a [file] [log] [blame]
shiqiane35fdd92008-12-10 05:08:54 +00001// Copyright 2008, Google Inc.
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
8// * Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// * Redistributions in binary form must reproduce the above
11// copyright notice, this list of conditions and the following disclaimer
12// in the documentation and/or other materials provided with the
13// distribution.
14// * Neither the name of Google Inc. nor the names of its
15// contributors may be used to endorse or promote products derived from
16// this software without specific prior written permission.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29//
30// Author: vadimb@google.com (Vadim Berman)
31//
32// Low-level types and utilities for porting Google Mock to various
33// platforms. They are subject to change without notice. DO NOT USE
34// THEM IN USER CODE.
35
36#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
37#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
38
39#include <assert.h>
40#include <stdlib.h>
41#include <iostream>
42
43// Most of the types needed for porting Google Mock are also required
44// for Google Test and are defined in gtest-port.h.
45#include <gtest/internal/gtest-linked_ptr.h>
46#include <gtest/internal/gtest-port.h>
47
48// To avoid conditional compilation everywhere, we make it
49// gmock-port.h's responsibility to #include the header implementing
zhanyong.wanbf550852009-06-09 06:09:53 +000050// tr1/tuple. gmock-port.h does this via gtest-port.h, which is
51// guaranteed to pull in the tuple header.
shiqiane35fdd92008-12-10 05:08:54 +000052
zhanyong.wan2b43a9e2009-08-31 23:51:23 +000053// For MS Visual C++, check the compiler version. At least VS 2003 is
shiqiane35fdd92008-12-10 05:08:54 +000054// required to compile Google Mock.
zhanyong.wan2b43a9e2009-08-31 23:51:23 +000055#if defined(_MSC_VER) && _MSC_VER < 1310
56#error "At least Visual C++ 2003 (7.1) is required to compile Google Mock."
57#endif
shiqiane35fdd92008-12-10 05:08:54 +000058
zhanyong.wane0d051e2009-02-19 00:33:37 +000059// Macro for referencing flags. This is public as we want the user to
60// use this syntax to reference Google Mock flags.
shiqiane35fdd92008-12-10 05:08:54 +000061#define GMOCK_FLAG(name) FLAGS_gmock_##name
62
63// Macros for declaring flags.
zhanyong.wane0d051e2009-02-19 00:33:37 +000064#define GMOCK_DECLARE_bool_(name) extern bool GMOCK_FLAG(name)
65#define GMOCK_DECLARE_int32_(name) \
shiqiane35fdd92008-12-10 05:08:54 +000066 extern ::testing::internal::Int32 GMOCK_FLAG(name)
zhanyong.wane0d051e2009-02-19 00:33:37 +000067#define GMOCK_DECLARE_string_(name) \
shiqiane35fdd92008-12-10 05:08:54 +000068 extern ::testing::internal::String GMOCK_FLAG(name)
69
70// Macros for defining flags.
zhanyong.wane0d051e2009-02-19 00:33:37 +000071#define GMOCK_DEFINE_bool_(name, default_val, doc) \
shiqiane35fdd92008-12-10 05:08:54 +000072 bool GMOCK_FLAG(name) = (default_val)
zhanyong.wane0d051e2009-02-19 00:33:37 +000073#define GMOCK_DEFINE_int32_(name, default_val, doc) \
shiqiane35fdd92008-12-10 05:08:54 +000074 ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
zhanyong.wane0d051e2009-02-19 00:33:37 +000075#define GMOCK_DEFINE_string_(name, default_val, doc) \
shiqiane35fdd92008-12-10 05:08:54 +000076 ::testing::internal::String GMOCK_FLAG(name) = (default_val)
77
78#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_