1 |
efrain |
1 |
/*
|
|
|
2 |
* Copyright 2017 Google
|
|
|
3 |
*
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
|
6 |
* You may obtain a copy of the License at
|
|
|
7 |
*
|
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9 |
*
|
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13 |
* See the License for the specific language governing permissions and
|
|
|
14 |
* limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
#ifndef FIRMessaging_xcodeproj_FIRMessagingDefines_h
|
|
|
18 |
#define FIRMessaging_xcodeproj_FIRMessagingDefines_h
|
|
|
19 |
|
|
|
20 |
// WEAKIFY & STRONGIFY
|
|
|
21 |
// Helper macro.
|
|
|
22 |
#define _FIRMessaging_WEAKNAME(VAR) VAR##_weak_
|
|
|
23 |
|
|
|
24 |
#define FIRMessaging_WEAKIFY(VAR) __weak __typeof__(VAR) _FIRMessaging_WEAKNAME(VAR) = (VAR);
|
|
|
25 |
|
|
|
26 |
#define FIRMessaging_STRONGIFY(VAR) \
|
|
|
27 |
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\"") \
|
|
|
28 |
__strong __typeof__(VAR) VAR = _FIRMessaging_WEAKNAME(VAR); \
|
|
|
29 |
_Pragma("clang diagnostic pop")
|
|
|
30 |
|
|
|
31 |
#ifndef _FIRMessaging_UL
|
|
|
32 |
#define _FIRMessaging_UL(v) (unsigned long)(v)
|
|
|
33 |
#endif
|
|
|
34 |
|
|
|
35 |
#endif
|
|
|
36 |
|
|
|
37 |
// Invalidates the initializer from which it's called.
|
|
|
38 |
#ifndef FIRMessagingInvalidateInitializer
|
|
|
39 |
#define FIRMessagingInvalidateInitializer() \
|
|
|
40 |
do { \
|
|
|
41 |
[self class]; /* Avoid warning of dead store to |self|. */ \
|
|
|
42 |
NSAssert(NO, @"Invalid initializer."); \
|
|
|
43 |
return nil; \
|
|
|
44 |
} while (0)
|
|
|
45 |
#endif
|