/core/externals/google-toolbox-for-mac/Foundation/GTMExceptionalInlines.h

http://macfuse.googlecode.com/ · C Header · 56 lines · 17 code · 6 blank · 33 comment · 0 complexity · 8f811ddb05d32b3d1861aa3a0aea6e15 MD5 · raw file

  1. //
  2. // GTMExceptionalInlines.h
  3. //
  4. // Copyright 2008 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #import <Foundation/Foundation.h>
  19. #import "GTMDefines.h"
  20. #if GTM_IPHONE_SDK
  21. #import <CoreGraphics/CoreGraphics.h>
  22. #endif // GTM_IPHONE_SDK
  23. // This file exists because when you have full warnings on you can run into
  24. // troubles with functions that Apple has inlined that have structures or
  25. // local variables defined in them.
  26. // You only see this warning if you have -Wuninitialized turned on,
  27. // and you will only see them in release mode. -Wno-unitialized turns them
  28. // off, but you also lose all the good warnings that come with -Wuninitialized.
  29. // If you have the inline versions of any of the functions below in a
  30. // @syncronized, or @try block, you will get
  31. // warning: variable 'r' might be clobbered by 'longjmp' or 'vfork'
  32. // By moving this local vars "out of line" you fix the problem.
  33. // These functions do nothing more than act as "out of line" calls to the
  34. // functions they are masking to avoid the warning.
  35. // If you run into others, feel free to add them.
  36. // Please only use these to avoid the warning above. Use the Apple defined
  37. // functions where possible.
  38. FOUNDATION_EXPORT NSRange GTMNSMakeRange(NSUInteger loc, NSUInteger len);
  39. FOUNDATION_EXPORT CFRange GTMCFRangeMake(NSUInteger loc, NSUInteger len);
  40. FOUNDATION_EXPORT CGPoint GTMCGPointMake(CGFloat x, CGFloat y);
  41. FOUNDATION_EXPORT CGSize GTMCGSizeMake(CGFloat width, CGFloat height);
  42. FOUNDATION_EXPORT CGRect GTMCGRectMake(CGFloat x, CGFloat y,
  43. CGFloat width, CGFloat height);
  44. #if !GTM_IPHONE_SDK
  45. // iPhone does not have NSTypes defined, only CGTypes. So no NSRect, NSPoint etc.
  46. FOUNDATION_EXPORT NSPoint GTMNSMakePoint(CGFloat x, CGFloat y);
  47. FOUNDATION_EXPORT NSSize GTMNSMakeSize(CGFloat w, CGFloat h);
  48. FOUNDATION_EXPORT NSRect GTMNSMakeRect(CGFloat x, CGFloat y,
  49. CGFloat w, CGFloat h);
  50. #endif