1 /* 2 Copyright 1999-2016 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. 6 obtain a copy of the License at 7 8 http://www.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 # pragma message("BCBMagick lib DLL export interface") 27 # define _MAGICKDLL_ 28 # define _MAGICKLIB_ 29 # define MAGICKCORE_MODULES_SUPPORT 30 # undef MAGICKCORE_BUILD_MODULES 31 #endif 32 33 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) 34 # define MagickPrivate 35 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB) 36 # define _MAGICKDLL_ 37 # endif 38 # if defined(_MAGICKDLL_) 39 # if defined(_VISUALC_) 40 # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */ 41 # endif 42 # if !defined(_MAGICKLIB_) 43 # if defined(__clang__) || defined(__GNUC__) 44 # define MagickExport __attribute__ ((dllimport)) 45 # else 46 # define MagickExport __declspec(dllimport) 47 # endif 48 # if defined(_VISUALC_) 49 # pragma message( "MagickCore lib DLL import interface" ) 50 # endif 51 # else 52 # if defined(__clang__) || defined(__GNUC__) 53 # define MagickExport __attribute__ ((dllexport)) 54 # else 55 # define MagickExport __declspec(dllexport) 56 # endif 57 # if defined(_VISUALC_) 58 # pragma message( "MagickCore lib DLL export interface" ) 59 # endif 60 # endif 61 # else 62 # define MagickExport 63 # if defined(_VISUALC_) 64 # pragma message( "MagickCore lib static interface" ) 65 # endif 66 # endif 67 68 # if defined(_DLL) && !defined(_LIB) 69 # if defined(__clang__) || defined(__GNUC__) 70 # define ModuleExport __attribute__ ((dllexport)) 71 # else 72 # define ModuleExport __declspec(dllexport) 73 # endif 74 # if defined(_VISUALC_) 75 # pragma message( "MagickCore module DLL export interface" ) 76 # endif 77 # else 78 # define ModuleExport 79 # if defined(_VISUALC_) 80 # pragma message( "MagickCore module static interface" ) 81 # endif 82 83 # endif 84 # if defined(_VISUALC_) 85 # pragma warning(disable : 4018) 86 # pragma warning(disable : 4068) 87 # pragma warning(disable : 4244) 88 # pragma warning(disable : 4142) 89 # pragma warning(disable : 4800) 90 # pragma warning(disable : 4786) 91 # pragma warning(disable : 4996) 92 # endif 93 #else 94 # if defined(__clang__) || (__GNUC__ >= 4) 95 # define MagickExport __attribute__ ((visibility ("default"))) 96 # define MagickPrivate __attribute__ ((visibility ("hidden"))) 97 # else 98 # define MagickExport 99 # define MagickPrivate 100 # endif 101 # define ModuleExport MagickExport 102 #endif 103 104 #define MagickCoreSignature 0xabacadabUL 105 #if !defined(MagickPathExtent) 106 # define MagickPathExtent 4096 /* always >= 4096 */ 107 #endif 108 # define MaxTextExtent MagickPathExtent 109 110 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__) 111 # define magick_aligned(x,y) x __attribute__((aligned(y))) 112 # define magick_attribute __attribute__ 113 # define magick_unused(x) magick_unused_ ## x __attribute__((unused)) 114 # define magick_unreferenced(x) /* nothing */ 115 #elif defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) 116 # define magick_aligned(x,y) __declspec(align(y)) x 117 # define magick_attribute(x) /* nothing */ 118 # define magick_unused(x) x 119 # define magick_unreferenced(x) (x) 120 #else 121 # define magick_aligned(x,y) /* nothing */ 122 # define magick_attribute(x) /* nothing */ 123 # define magick_unused(x) x 124 # define magick_unreferenced(x) /* nothing */ 125 #endif 126 127 #if !defined(__clang__) && (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) 128 # define magick_alloc_size(x) __attribute__((__alloc_size__(x))) 129 # define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y))) 130 #else 131 # define magick_alloc_size(x) /* nothing */ 132 # define magick_alloc_sizes(x,y) /* nothing */ 133 #endif 134 135 #if defined(__clang__) || (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) 136 # define magick_cold_spot __attribute__((__cold__)) 137 # define magick_hot_spot __attribute__((__hot__)) 138 #else 139 # define magick_cold_spot 140 # define magick_hot_spot 141 #endif 142 143 #if defined(__cplusplus) || defined(c_plusplus) 144 } 145 #endif 146 147 #endif 148