1 /* 2 Copyright 1999-2019 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 92 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__) 93 # define magick_aligned(x,y) x __attribute__((aligned(y))) 94 # define magick_attribute __attribute__ 95 # define magick_unused(x) magick_unused_ ## x __attribute__((unused)) 96 # define magick_unreferenced(x) /* nothing */ 97 #elif defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) 98 # define magick_aligned(x,y) __declspec(align(y)) x 99 # define magick_attribute(x) /* nothing */ 100 # define magick_unused(x) x 101 # define magick_unreferenced(x) (x) 102 #else 103 # define magick_aligned(x,y) /* nothing */ 104 # define magick_attribute(x) /* nothing */ 105 # define magick_unused(x) x 106 # define magick_unreferenced(x) /* nothing */ 107 #endif 108 109 #if !defined(__clang__) && (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) 110 # define magick_alloc_size(x) __attribute__((__alloc_size__(x))) 111 # define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y))) 112 #else 113 # define magick_alloc_size(x) /* nothing */ 114 # define magick_alloc_sizes(x,y) /* nothing */ 115 #endif 116 117 #if defined(__clang__) || (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) 118 # define magick_cold_spot __attribute__((__cold__)) 119 # define magick_hot_spot __attribute__((__hot__)) 120 #else 121 # define magick_cold_spot 122 # define magick_hot_spot 123 #endif 124 125 #if defined(__cplusplus) || defined(c_plusplus) 126 } 127 #endif 128 129 #endif 130