Austin Schuh | 0cbef62 | 2015-09-06 17:34:52 -0700 | [diff] [blame^] | 1 | // 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. All macros ending with _ and symbols defined in an |
| 34 | // internal namespace are subject to change without notice. Code |
| 35 | // outside Google Mock MUST NOT USE THEM DIRECTLY. Macros that don't |
| 36 | // end with _ are part of Google Mock's public API and can be used by |
| 37 | // code outside Google Mock. |
| 38 | |
| 39 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ |
| 40 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ |
| 41 | |
| 42 | #include <assert.h> |
| 43 | #include <stdlib.h> |
| 44 | #include <iostream> |
| 45 | |
| 46 | // Most of the utilities needed for porting Google Mock are also |
| 47 | // required for Google Test and are defined in gtest-port.h. |
| 48 | // |
| 49 | // Note to maintainers: to reduce code duplication, prefer adding |
| 50 | // portability utilities to Google Test's gtest-port.h instead of |
| 51 | // here, as Google Mock depends on Google Test. Only add a utility |
| 52 | // here if it's truly specific to Google Mock. |
| 53 | #include "gtest/internal/gtest-linked_ptr.h" |
| 54 | #include "gtest/internal/gtest-port.h" |
| 55 | #include "gmock/internal/custom/gmock-port.h" |
| 56 | |
| 57 | // To avoid conditional compilation everywhere, we make it |
| 58 | // gmock-port.h's responsibility to #include the header implementing |
| 59 | // tr1/tuple. gmock-port.h does this via gtest-port.h, which is |
| 60 | // guaranteed to pull in the tuple header. |
| 61 | |
| 62 | // For MS Visual C++, check the compiler version. At least VS 2003 is |
| 63 | // required to compile Google Mock. |
| 64 | #if defined(_MSC_VER) && _MSC_VER < 1310 |
| 65 | # error "At least Visual C++ 2003 (7.1) is required to compile Google Mock." |
| 66 | #endif |
| 67 | |
| 68 | // Macro for referencing flags. This is public as we want the user to |
| 69 | // use this syntax to reference Google Mock flags. |
| 70 | #define GMOCK_FLAG(name) FLAGS_gmock_##name |
| 71 | |
| 72 | #if !defined(GMOCK_DECLARE_bool_) |
| 73 | |
| 74 | // Macros for declaring flags. |
| 75 | #define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name) |
| 76 | #define GMOCK_DECLARE_int32_(name) \ |
| 77 | extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) |
| 78 | #define GMOCK_DECLARE_string_(name) \ |
| 79 | extern GTEST_API_ ::std::string GMOCK_FLAG(name) |
| 80 | |
| 81 | // Macros for defining flags. |
| 82 | #define GMOCK_DEFINE_bool_(name, default_val, doc) \ |
| 83 | GTEST_API_ bool GMOCK_FLAG(name) = (default_val) |
| 84 | #define GMOCK_DEFINE_int32_(name, default_val, doc) \ |
| 85 | GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val) |
| 86 | #define GMOCK_DEFINE_string_(name, default_val, doc) \ |
| 87 | GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val) |
| 88 | |
| 89 | #endif // !defined(GMOCK_DECLARE_bool_) |
| 90 | |
| 91 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ |