Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ | 5 #ifndef CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ |
| 6 #define CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ | 6 #define CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // libclosure (blocks) compatibilty for Mac OS X 10.5 (Leopard) | 9 // libclosure (blocks) compatibilty for Mac OS X 10.5 (Leopard) |
| 10 // | 10 // |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 // Both GCC and clang emit references to these symbols, providing implicit | 54 // Both GCC and clang emit references to these symbols, providing implicit |
| 55 // declarations as needed, but respecting any user declaration when present. | 55 // declarations as needed, but respecting any user declaration when present. |
| 56 // See gcc-5666.3/gcc/c-parser.c build_block_struct_initlist, | 56 // See gcc-5666.3/gcc/c-parser.c build_block_struct_initlist, |
| 57 // gcc-5666.3/gcc/cp/parser.c build_block_struct_initlist, and | 57 // gcc-5666.3/gcc/cp/parser.c build_block_struct_initlist, and |
| 58 // clang-2.9/lib/CodeGen/CodeGenModule.cpp | 58 // clang-2.9/lib/CodeGen/CodeGenModule.cpp |
| 59 // CodeGenModule::getNSConcreteGlobalBlock() and | 59 // CodeGenModule::getNSConcreteGlobalBlock() and |
| 60 // CodeGenModule::getNSConcreteStackBlock(). | 60 // CodeGenModule::getNSConcreteStackBlock(). |
| 61 | 61 |
| 62 #include <AvailabilityMacros.h> | 62 #include <AvailabilityMacros.h> |
| 63 | 63 |
| 64 #if defined(MAC_OS_X_VERSION_10_6) && \ | |
| 65 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 // SDK >= 10.6 | |
| 66 // Get the system's own declarations of these things if using an SDK where | |
| 67 // they are present. | |
| 68 #include <Block.h> | |
| 69 #endif // SDK >= 10.6 | |
| 70 | |
| 64 extern "C" { | 71 extern "C" { |
| 65 | 72 |
| 66 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5 // DT <= 10.5 | 73 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5 // DT <= 10.5 |
| 67 #define MAYBE_WEAK_IMPORT __attribute__((weak_import)) | 74 #define MAYBE_WEAK_IMPORT __attribute__((weak_import)) |
| 68 #else // DT > 10.5 | 75 #else // DT > 10.5 |
| 69 #define MAYBE_WEAK_IMPORT | 76 #define MAYBE_WEAK_IMPORT |
| 70 #endif // DT <= 10.5 | 77 #endif // DT <= 10.5 |
| 71 | 78 |
| 79 MAYBE_WEAK_IMPORT extern void* _Block_copy(const void*); | |
| 80 MAYBE_WEAK_IMPORT extern void _Block_release(const void*); | |
| 81 MAYBE_WEAK_IMPORT extern void _Block_object_assign(void*, | |
| 82 const void*, | |
| 83 const int); | |
| 84 MAYBE_WEAK_IMPORT extern void _Block_object_dispose(const void*, const int); | |
|
Nico
2011/08/16 17:18:14
since you declare these here, why do you need the
Mark Mentovai
2011/08/16 17:54:07
Nico wrote:
| |
| 85 | |
| 72 MAYBE_WEAK_IMPORT extern void* _NSConcreteGlobalBlock[32]; | 86 MAYBE_WEAK_IMPORT extern void* _NSConcreteGlobalBlock[32]; |
| 73 MAYBE_WEAK_IMPORT extern void* _NSConcreteStackBlock[32]; | 87 MAYBE_WEAK_IMPORT extern void* _NSConcreteStackBlock[32]; |
| 74 | 88 |
| 75 #undef MAYBE_WEAK_IMPORT | 89 #undef MAYBE_WEAK_IMPORT |
| 76 | 90 |
| 77 } // extern "C" | 91 } // extern "C" |
| 78 | 92 |
| 93 // Macros from <Block.h>, in case <Block.h> is not present. | |
| 94 | |
| 95 #ifndef Block_copy | |
| 96 #define Block_copy(...) \ | |
| 97 ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__))) | |
| 98 #endif | |
| 99 | |
| 100 #ifndef Block_release | |
| 101 #define Block_release(...) _Block_release((const void *)(__VA_ARGS__)) | |
| 102 #endif | |
| 103 | |
| 79 #endif // CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ | 104 #endif // CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ |
| OLD | NEW |