method-attribute.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. Copyright 1999 ImageMagick Studio LLC, a non-profit organization
  3. dedicated to making software imaging solutions freely available.
  4. You may not use this file except in compliance with the License. You may
  5. obtain a copy of the License at
  6. https://imagemagick.org/script/license.php
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. MagickWand method attribute.
  13. */
  14. #ifndef MAGICKWAND_METHOD_ATTRIBUTE_H
  15. #define MAGICKWAND_METHOD_ATTRIBUTE_H
  16. #if defined(__cplusplus) || defined(c_plusplus)
  17. extern "C" {
  18. #endif
  19. #if defined(__BORLANDC__) && defined(_DLL)
  20. # define _MAGICKDLL_
  21. # define _MAGICKLIB_
  22. # define MAGICKCORE_MODULES_SUPPORT
  23. # undef MAGICKCORE_BUILD_MODULES
  24. #endif
  25. #if defined(MAGICKWAND_WINDOWS_SUPPORT) && !defined(__CYGWIN__)
  26. # define WandPrivate
  27. # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
  28. # define _MAGICKDLL_
  29. # endif
  30. # if defined(_MAGICKDLL_)
  31. # if defined(_VISUALC_)
  32. # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
  33. # endif
  34. # if !defined(_MAGICKLIB_)
  35. # if defined(__clang__) || defined(__GNUC__)
  36. # define WandExport __attribute__ ((dllimport))
  37. # else
  38. # define WandExport __declspec(dllimport)
  39. # endif
  40. # else
  41. # if defined(__clang__) || defined(__GNUC__)
  42. # define WandExport __attribute__ ((dllexport))
  43. # else
  44. # define WandExport __declspec(dllexport)
  45. # endif
  46. # endif
  47. # else
  48. # define WandExport
  49. # endif
  50. # if defined(_VISUALC_)
  51. # pragma warning(disable : 4018)
  52. # pragma warning(disable : 4068)
  53. # pragma warning(disable : 4244)
  54. # pragma warning(disable : 4142)
  55. # pragma warning(disable : 4800)
  56. # pragma warning(disable : 4786)
  57. # pragma warning(disable : 4996)
  58. # endif
  59. #else
  60. # if defined(__clang__) || (__GNUC__ >= 4)
  61. # define WandExport __attribute__ ((visibility ("default")))
  62. # define WandPrivate __attribute__ ((visibility ("hidden")))
  63. # else
  64. # define WandExport
  65. # define WandPrivate
  66. # endif
  67. #endif
  68. #define WandSignature 0xabacadabUL
  69. #if !defined(MaxTextExtent)
  70. # define MaxTextExtent 4096
  71. #endif
  72. #if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
  73. # define wand_aligned(x) __attribute__((aligned(x)))
  74. # define wand_attribute __attribute__
  75. # define wand_unused(x) wand_unused_ ## x __attribute__((unused))
  76. # define wand_unreferenced(x)
  77. #elif defined(MAGICKWAND_WINDOWS_SUPPORT) && !defined(__CYGWIN__)
  78. # define wand_aligned(x) __declspec(align(x))
  79. # define wand_attribute(x) /* nothing */
  80. # define wand_unused(x) x
  81. # define wand_unreferenced(x) (x)
  82. #else
  83. # define wand_aligned(x) /* nothing */
  84. # define wand_attribute(x) /* nothing */
  85. # define wand_unused(x) x
  86. # define wand_unreferenced(x) /* nothing */
  87. #endif
  88. #if !defined(__clang__) && (defined(__GNUC__) && (__GNUC__) > 4)
  89. # define wand_alloc_size(x) __attribute__((__alloc_size__(x)))
  90. # define wand_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y)))
  91. #else
  92. # define wand_alloc_size(x) /* nothing */
  93. # define wand_alloc_sizes(x,y) /* nothing */
  94. #endif
  95. #if !defined(__clang__) && (defined(__GNUC__) && (__GNUC__) > 4)
  96. # define wand_cold_spot __attribute__((__cold__))
  97. # define wand_hot_spot __attribute__((__hot__))
  98. #else
  99. # define wand_cold_spot
  100. # define wand_hot_spot
  101. #endif
  102. #if defined(__cplusplus) || defined(c_plusplus)
  103. }
  104. #endif
  105. #endif