GTLRDefines.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Copyright (c) 2011 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. //
  16. // GTLRDefines.h
  17. //
  18. #import <Foundation/Foundation.h>
  19. #ifndef GTLR_DEBUG_ASSERT
  20. #if DEBUG && !defined(NS_BLOCK_ASSERTIONS)
  21. // NSCAssert to avoid capturing self if used in a block.
  22. #define GTLR_DEBUG_ASSERT(condition, ...) NSCAssert(condition, __VA_ARGS__)
  23. #elif DEBUG
  24. // In DEBUG builds with assertions blocked, log to avoid unused variable warnings.
  25. #define GTLR_DEBUG_ASSERT(condition, ...) if (!(condition)) { NSLog(__VA_ARGS__); }
  26. #else
  27. #define GTLR_DEBUG_ASSERT(condition, ...) do { } while (0)
  28. #endif
  29. #endif
  30. #ifndef GTLR_DEBUG_LOG
  31. #if DEBUG
  32. #define GTLR_DEBUG_LOG(...) NSLog(__VA_ARGS__)
  33. #else
  34. #define GTLR_DEBUG_LOG(...) do { } while (0)
  35. #endif
  36. #endif