1 /* 2 Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization 3 dedicated to making software imaging solutions freely available. 4 5 You may not use this file except in compliance with the License. You may 6 obtain a copy of the License at 7 8 https://imagemagick.org/script/license.php 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 MagickCore method attributes. 17 */ 18 #ifndef MAGICKCORE_METHOD_ATTRIBUTE_H 19 #define MAGICKCORE_METHOD_ATTRIBUTE_H 20 21 #if defined(__cplusplus) || defined(c_plusplus) 22 extern "C" { 23 #endif 24 25 #if defined(__BORLANDC__) && defined(_DLL) 26 # define _MAGICKDLL_ 27 # define _MAGICKLIB_ 28 # define MAGICKCORE_MODULES_SUPPORT 29 # undef MAGICKCORE_BUILD_MODULES 30 #endif 31 32 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) 33 # define MagickPrivate 34 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB) 35 # define _MAGICKDLL_ 36 # endif 37 # if defined(_MAGICKDLL_) 38 # if defined(_VISUALC_) 39 # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */ 40 # endif 41 # if !defined(_MAGICKLIB_) 42 # if defined(__clang__) || defined(__GNUC__) 43 # define MagickExport __attribute__ ((dllimport)) 44 # else 45 # define MagickExport __declspec(dllimport) 46 # endif 47 # else 48 # if defined(__clang__) || defined(__GNUC__) 49 # define MagickExport __attribute__ ((dllexport)) 50 # else 51 # define MagickExport __declspec(dllexport) 52 # endif 53 # endif 54 # else 55 # define MagickExport 56 # endif 57 # if defined(_DLL) && !defined(_LIB) 58 # if defined(__clang__) || defined(__GNUC__) 59 # define ModuleExport __attribute__ ((dllexport)) 60 # else 61 # define ModuleExport __declspec(dllexport) 62 # endif 63 # else 64 # define ModuleExport 65 # endif 66 # if defined(_VISUALC_) 67 # pragma warning(disable : 4018) 68 # pragma warning(disable : 4068) 69 # pragma warning(disable : 4244) 70 # pragma warning(disable : 4142) 71 # pragma warning(disable : 4800) 72 # pragma warning(disable : 4786) 73 # pragma warning(disable : 4996) 74 # endif 75 #else 76 # if defined(__clang__) || (__GNUC__ >= 4) 77 # define MagickExport __attribute__ ((visibility ("default"))) 78 # define MagickPrivate __attribute__ ((visibility ("hidden"))) 79 # else 80 # define MagickExport 81 # define MagickPrivate 82 # endif 83 # define ModuleExport MagickExport 84 #endif 85 86 #define MagickCoreSignature 0xabacadabUL 87 #if !defined(MagickPathExtent) 88 # define MagickPathExtent 4096 /* always >= 4096 */ 89 #endif 90 #define MaxTextExtent MagickPathExtent 91 #define MagickTimeExtent 26 92 93 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__) 94 # define magick_aligned(x,y) x __attribute__((aligned(y))) 95 # define magick_attribute __attribute__ 96 # define magick_unused(x) magick_unused_ ## x __attribute__((unused)) 97 # define magick_unreferenced(x) /* nothing */ 98 #elif defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) 99 # define magick_aligned(x,y) __declspec(align(y)) x 100 # define magick_attribute(x) /* nothing */ 101 # define magick_unused(x) x 102 # define magick_unreferenced(x) (x) 103 #else 104 # define magick_aligned(x,y) /* nothing */ 105 # define magick_attribute(x) /* nothing */ 106 # define magick_unused(x) x 107 # define magick_unreferenced(x) /* nothing */ 108 #endif 109 110 #if !defined(__clang__) && (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) 111 # define magick_alloc_size(x) __attribute__((__alloc_size__(x))) 112 # define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y))) 113 #else 114 # define magick_alloc_size(x) /* nothing */ 115 # define magick_alloc_sizes(x,y) /* nothing */ 116 #endif 117 118 #if defined(__clang__) || (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) 119 # define magick_cold_spot __attribute__((__cold__)) 120 # define magick_hot_spot __attribute__((__hot__)) 121 #else 122 # define magick_cold_spot 123 # define magick_hot_spot 124 #endif 125 126 #if defined(__cplusplus) || defined(c_plusplus) 127 } 128 #endif 129 130 #endif 131