github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/internal/cef_build.h (about) 1 // Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // 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 31 #ifndef CEF_INCLUDE_INTERNAL_CEF_BUILD_H_ 32 #define CEF_INCLUDE_INTERNAL_CEF_BUILD_H_ 33 #pragma once 34 35 #if defined(BUILDING_CEF_SHARED) 36 37 #include "base/compiler_specific.h" 38 39 #else // !BUILDING_CEF_SHARED 40 41 #if defined(_WIN32) 42 #ifndef OS_WIN 43 #define OS_WIN 1 44 #endif 45 #elif defined(__APPLE__) 46 #ifndef OS_MACOSX 47 #define OS_MACOSX 1 48 #endif 49 #elif defined(__linux__) 50 #ifndef OS_LINUX 51 #define OS_LINUX 1 52 #endif 53 #else 54 #error Please add support for your platform in cef_build.h 55 #endif 56 57 // For access to standard POSIXish features, use OS_POSIX instead of a 58 // more specific macro. 59 #if defined(OS_MACOSX) || defined(OS_LINUX) 60 #ifndef OS_POSIX 61 #define OS_POSIX 1 62 #endif 63 #endif 64 65 // Compiler detection. 66 #if defined(__GNUC__) 67 #ifndef COMPILER_GCC 68 #define COMPILER_GCC 1 69 #endif 70 #elif defined(_MSC_VER) 71 #ifndef COMPILER_MSVC 72 #define COMPILER_MSVC 1 73 #endif 74 #else 75 #error Please add support for your compiler in cef_build.h 76 #endif 77 78 // Annotate a virtual method indicating it must be overriding a virtual 79 // method in the parent class. 80 // Use like: 81 // virtual void foo() OVERRIDE; 82 #ifndef OVERRIDE 83 #if defined(COMPILER_MSVC) 84 #define OVERRIDE override 85 #elif defined(__clang__) 86 #define OVERRIDE override 87 #else 88 #define OVERRIDE 89 #endif 90 #endif 91 92 #ifndef ALLOW_THIS_IN_INITIALIZER_LIST 93 #if defined(COMPILER_MSVC) 94 95 // MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled. 96 // The warning remains disabled until popped by MSVC_POP_WARNING. 97 #define MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \ 98 __pragma(warning(disable:n)) 99 100 // MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level 101 // remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all 102 // warnings. 103 #define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n)) 104 105 // Pop effects of innermost MSVC_PUSH_* macro. 106 #define MSVC_POP_WARNING() __pragma(warning(pop)) 107 108 // Allows |this| to be passed as an argument in constructor initializer lists. 109 // This uses push/pop instead of the seemingly simpler suppress feature to avoid 110 // having the warning be disabled for more than just |code|. 111 // 112 // Example usage: 113 // Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {} 114 // 115 // Compiler warning C4355: 'this': used in base member initializer list: 116 // http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx 117 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) MSVC_PUSH_DISABLE_WARNING(4355) \ 118 code \ 119 MSVC_POP_WARNING() 120 #else // !COMPILER_MSVC 121 122 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) code 123 124 #endif // !COMPILER_MSVC 125 #endif 126 127 #endif // !BUILDING_CEF_SHARED 128 129 #endif // CEF_INCLUDE_INTERNAL_CEF_BUILD_H_