Debian Codegraph @

debian/missing-sources/htslib/hts_defs.h

raw symbols SCIP
1 /* hts_defs.h -- Miscellaneous definitions.
2
3 Copyright (C) 2013-2015,2017, 2019 Genome Research Ltd.
4
5 Author: John Marshall <[email protected]>
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 DEALINGS IN THE SOFTWARE. */
24
25 #ifndef HTSLIB_HTS_DEFS_H
26 #define HTSLIB_HTS_DEFS_H
27
28 #include <stdio.h> // For __MINGW_PRINTF_FORMAT macro
29
30 #ifdef __clang__
31 #ifdef __has_attribute
32 #define HTS_COMPILER_HAS(attribute) __has_attribute(attribute)
33 #endif
34
35 #elif defined __GNUC__
36 #define HTS_GCC_AT_LEAST(major, minor) \
37 (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
38 #endif
39
40 #ifndef HTS_COMPILER_HAS
41 #define HTS_COMPILER_HAS(attribute) 0
42 #endif
43 #ifndef HTS_GCC_AT_LEAST
44 #define HTS_GCC_AT_LEAST(major, minor) 0
45 #endif
46
47 #if HTS_COMPILER_HAS(__noreturn__) || HTS_GCC_AT_LEAST(3,0)
48 #define HTS_NORETURN __attribute__ ((__noreturn__))
49 #else
50 #define HTS_NORETURN
51 #endif
52
53 // GCC introduced warn_unused_result in 3.4 but added -Wno-unused-result later
54 #if HTS_COMPILER_HAS(__warn_unused_result__) || HTS_GCC_AT_LEAST(4,5)
55 #define HTS_RESULT_USED __attribute__ ((__warn_unused_result__))
56 #else
57 #define HTS_RESULT_USED
58 #endif
59
60 #if HTS_COMPILER_HAS(__unused__) || HTS_GCC_AT_LEAST(3,0)
61 #define HTS_UNUSED __attribute__ ((__unused__))
62 #else
63 #define HTS_UNUSED
64 #endif
65
66 #if HTS_COMPILER_HAS(__deprecated__) || HTS_GCC_AT_LEAST(4,5)
67 #define HTS_DEPRECATED(message) __attribute__ ((__deprecated__ (message)))
68 #elif HTS_GCC_AT_LEAST(3,1)
69 #define HTS_DEPRECATED(message) __attribute__ ((__deprecated__))
70 #else
71 #define HTS_DEPRECATED(message)
72 #endif
73
74 #if HTS_COMPILER_HAS(__deprecated__) || HTS_GCC_AT_LEAST(6,4)
75 #define HTS_DEPRECATED_ENUM(message) __attribute__ ((__deprecated__ (message)))
76 #else
77 #define HTS_DEPRECATED_ENUM(message)
78 #endif
79
80 // On mingw the "printf" format type doesn't work. It needs "gnu_printf"
81 // in order to check %lld and %z, otherwise it defaults to checking against
82 // the Microsoft library printf format options despite linking against the
83 // GNU posix implementation of printf. The __MINGW_PRINTF_FORMAT macro
84 // expands to printf or gnu_printf as required, but obviously may not
85 // exist
86 #ifdef __MINGW_PRINTF_FORMAT
87 #define HTS_PRINTF_FMT __MINGW_PRINTF_FORMAT
88 #else
89 #define HTS_PRINTF_FMT printf
90 #endif
91
92 #if HTS_COMPILER_HAS(__format__) || HTS_GCC_AT_LEAST(3,0)
93 #define HTS_FORMAT(type, idx, first) __attribute__((__format__ (type, idx, first)))
94 #else
95 #define HTS_FORMAT(type, idx, first)
96 #endif
97
98 #if defined(_WIN32) || defined(__CYGWIN__)
99 #define HTS_DLL_EXPORT __declspec(dllexport)
100 #elif HTS_COMPILER_HAS(__visibility__) || HTS_GCC_AT_LEAST(4,0)
101 #define HTS_DLL_EXPORT __attribute__((__visibility__("default")))
102 #elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x550
103 #define HTS_DLL_EXPORT __global
104 #else
105 #define HTS_DLL_EXPORT
106 #endif
107
108 #if !(defined(_WIN32) || defined(__CYGWIN__)) || defined(HTS_BUILDING_LIBRARY)
109 #define HTSLIB_EXPORT HTS_DLL_EXPORT
110 #else
111 #define HTSLIB_EXPORT
112 #endif
113
114 #endif