| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#ifndef HTSLIB_HTS_DEFS_H |
| 26 |
#define HTSLIB_HTS_DEFS_H |
| 27 |
|
| 28 |
#include <stdio.h> |
| 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 |
|
| 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 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 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 |