Added Android code
[wl-app.git] / iOS / Pods / FirebaseMessaging / Firebase / Messaging / FIRMessagingDefines.h
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 #define _FIRMessaging_VERBOSE_LOGGING 1
21
22 // Verbose Logging
23 #if (_FIRMessaging_VERBOSE_LOGGING)
24 #define FIRMessaging_DEV_VERBOSE_LOG(...) NSLog(__VA_ARGS__)
25 #else
26 #define FIRMessaging_DEV_VERBOSE_LOG(...) do { } while (0)
27 #endif // FIRMessaging_VERBOSE_LOGGING
28
29
30 // WEAKIFY & STRONGIFY
31 // Helper macro.
32 #define _FIRMessaging_WEAKNAME(VAR) VAR ## _weak_
33
34 #define FIRMessaging_WEAKIFY(VAR) __weak __typeof__(VAR) _FIRMessaging_WEAKNAME(VAR) = (VAR);
35
36 #define FIRMessaging_STRONGIFY(VAR) \
37 _Pragma("clang diagnostic push") \
38 _Pragma("clang diagnostic ignored \"-Wshadow\"") \
39 __strong __typeof__(VAR) VAR = _FIRMessaging_WEAKNAME(VAR); \
40 _Pragma("clang diagnostic pop")
41
42
43 // Type Conversions (used for NSInteger etc)
44 #ifndef _FIRMessaging_L
45 #define _FIRMessaging_L(v) (long)(v)
46 #endif
47
48 #ifndef _FIRMessaging_UL
49 #define _FIRMessaging_UL(v) (unsigned long)(v)
50 #endif
51
52 #endif
53
54 // Debug Assert
55 #ifndef _FIRMessagingDevAssert
56 // we directly invoke the NSAssert handler so we can pass on the varargs
57 // (NSAssert doesn't have a macro we can use that takes varargs)
58 #if !defined(NS_BLOCK_ASSERTIONS)
59 #define _FIRMessagingDevAssert(condition, ...)                                       \
60   do {                                                                      \
61     if (!(condition)) {                                                     \
62       [[NSAssertionHandler currentHandler]                                  \
63           handleFailureInFunction:(NSString *)                              \
64                                       [NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
65                              file:(NSString *)[NSString stringWithUTF8String:__FILE__]  \
66                        lineNumber:__LINE__                                  \
67                       description:__VA_ARGS__];                             \
68     }                                                                       \
69   } while(0)
70 #else // !defined(NS_BLOCK_ASSERTIONS)
71 #define _FIRMessagingDevAssert(condition, ...) do { } while (0)
72 #endif // !defined(NS_BLOCK_ASSERTIONS)
73
74 #endif // _FIRMessagingDevAssert
75
76 // Invalidates the initializer from which it's called.
77 #ifndef FIRMessagingInvalidateInitializer
78 #define FIRMessagingInvalidateInitializer() \
79   do { \
80     [self class]; /* Avoid warning of dead store to |self|. */ \
81     _FIRMessagingDevAssert(NO, @"Invalid initializer."); \
82     return nil; \
83   } while (0)
84 #endif