You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.5 KiB

6 years ago
6 years ago
  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. #ifndef FIRMessaging_xcodeproj_FIRMessagingDefines_h
  17. #define FIRMessaging_xcodeproj_FIRMessagingDefines_h
  18. // WEAKIFY & STRONGIFY
  19. // Helper macro.
  20. #define _FIRMessaging_WEAKNAME(VAR) VAR ## _weak_
  21. #define FIRMessaging_WEAKIFY(VAR) __weak __typeof__(VAR) _FIRMessaging_WEAKNAME(VAR) = (VAR);
  22. #define FIRMessaging_STRONGIFY(VAR) \
  23. _Pragma("clang diagnostic push") \
  24. _Pragma("clang diagnostic ignored \"-Wshadow\"") \
  25. __strong __typeof__(VAR) VAR = _FIRMessaging_WEAKNAME(VAR); \
  26. _Pragma("clang diagnostic pop")
  27. #ifndef _FIRMessaging_UL
  28. #define _FIRMessaging_UL(v) (unsigned long)(v)
  29. #endif
  30. #endif
  31. // Invalidates the initializer from which it's called.
  32. #ifndef FIRMessagingInvalidateInitializer
  33. #define FIRMessagingInvalidateInitializer() \
  34. do { \
  35. [self class]; /* Avoid warning of dead store to |self|. */ \
  36. NSAssert(NO, @"Invalid initializer."); \
  37. return nil; \
  38. } while (0)
  39. #endif