blob: a0b0e77406f95193d989fd4a1cdb56bcaf8891f0 [file] [log] [blame]
cristyb2b54812012-02-19 18:15:55 +00001/*
cristyfe676ee2013-11-18 13:03:38 +00002 Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization
cristyb2b54812012-02-19 18:15:55 +00003 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)
22extern "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_)
cristy483eeb62014-01-12 22:12:44 +000043# if defined(__clang__) || defined(__GNUC__)
cristyb2b54812012-02-19 18:15:55 +000044# 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
cristy483eeb62014-01-12 22:12:44 +000052# if defined(__clang__) || defined(__GNUC__)
cristyb2b54812012-02-19 18:15:55 +000053# 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)
cristy483eeb62014-01-12 22:12:44 +000069# if defined(__clang__) || defined(__GNUC__)
cristyb2b54812012-02-19 18:15:55 +000070# 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
cristyb2b54812012-02-19 18:15:55 +000084# 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
cristy483eeb62014-01-12 22:12:44 +000094# if defined(__clang__) || (__GNUC__ >= 4)
cristyb2b54812012-02-19 18:15:55 +000095# 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
cristyb2b54812012-02-19 18:15:55 +0000102#endif
103
104#define MagickSignature 0xabacadabUL
105#if !defined(MaxTextExtent)
cristyce9db092013-01-16 22:16:51 +0000106# define MaxTextExtent 4096 /* always >= 4096 */
cristyb2b54812012-02-19 18:15:55 +0000107#endif
108
109#if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
cristyad9b6042013-04-19 17:06:27 +0000110# define magick_aligned(x,y) x __attribute__((aligned(y)))
cristyb2b54812012-02-19 18:15:55 +0000111# define magick_attribute __attribute__
112# define magick_unused(x) magick_unused_ ## x __attribute__((unused))
cristyf034abb2013-11-24 14:16:14 +0000113# define magick_unreferenced(x) /* nothing */
cristyf49af1b2012-10-23 16:03:57 +0000114#elif defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__)
cristyad9b6042013-04-19 17:06:27 +0000115# define magick_aligned(x,y) __declspec(align(y)) x
cristyf49af1b2012-10-23 16:03:57 +0000116# define magick_attribute(x) /* nothing */
117# define magick_unused(x) x
cristyf034abb2013-11-24 14:16:14 +0000118# define magick_unreferenced(x) (x)
cristyb2b54812012-02-19 18:15:55 +0000119#else
cristyad9b6042013-04-19 17:06:27 +0000120# define magick_aligned(x,y) /* nothing */
cristyb2b54812012-02-19 18:15:55 +0000121# define magick_attribute(x) /* nothing */
122# define magick_unused(x) x
cristyf034abb2013-11-24 14:16:14 +0000123# define magick_unreferenced(x) /* nothing */
cristyb2b54812012-02-19 18:15:55 +0000124#endif
125
cristy55a94662014-03-05 00:51:48 +0000126#if defined(__apple_build_version__)
127# define magick_alloc_size(x) __attribute__((__alloc_size__(x)))
128# define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y)))
129# define magick_cold_spot
130# define magick_hot_spot
131#else
cristy483eeb62014-01-12 22:12:44 +0000132#if defined(__clang__) || (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
cristyb2b54812012-02-19 18:15:55 +0000133# define magick_alloc_size(x) __attribute__((__alloc_size__(x)))
134# define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y)))
135# define magick_cold_spot __attribute__((__cold__))
136# define magick_hot_spot __attribute__((__hot__))
137#else
138# define magick_alloc_size(x) /* nothing */
139# define magick_alloc_sizes(x,y) /* nothing */
140# define magick_cold_spot
141# define magick_hot_spot
142#endif
cristy55a94662014-03-05 00:51:48 +0000143#endif
cristyb2b54812012-02-19 18:15:55 +0000144
145#if defined(__cplusplus) || defined(c_plusplus)
146}
147#endif
148
149#endif