/usr/include/cxmacros.h is in libcext-dev 6.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | /* $Id: cxmacros.h,v 1.7 2011-02-21 14:15:31 rpalsa Exp $
*
* This file is part of the ESO C Extension Library
* Copyright (C) 2001-2011 European Southern Observatory
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* $Author: rpalsa $
* $Date: 2011-02-21 14:15:31 $
* $Revision: 1.7 $
* $Name: not supported by cvs2svn $
*/
/*
* This file MUST not include any other cext header file.
*/
#ifndef CX_MACROS_H
#define CX_MACROS_H
/*
* Get the system's definition of NULL from stddef.h
*/
#include <stddef.h>
/*
* An alias for __extension__
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
# define CX_GNUC_EXTENSION __extension__
#else
# define CX_GNUC_EXTENSION
#endif
/*
* Macros for the GNU compiler function attributes
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define CX_GNUC_PURE __attribute__((__pure__))
# define CX_GNUC_MALLOC __attribute__((__malloc__))
#else
# define G_GNUC_PURE
# define G_GNUC_MALLOC
#endif
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
# define CX_GNUC_PRINTF(fmt_idx, arg_idx) \
__attribute__((__format__ (__printf__, fmt_idx, arg_idx)))
# define CX_GNUC_SCANF(fmt_idx, arg_idx) \
__attribute__((__format__ (__scanf__, fmt_idx, arg_idx)))
# define CX_GNUC_FORMAT(arg_idx) __attribute__((__format_arg__ (arg_idx)))
# define CX_GNUC_NORETURN __attribute__((__noreturn__))
# define CX_GNUC_CONST __attribute__((__const__))
# define CX_GNUC_UNUSED __attribute__((__unused__))
#else
# define CX_GNUC_PRINTF(fmt_idx, arg_idx)
# define CX_GNUC_SCANF(fmt_idx, arg_idx)
# define CX_GNUC_FORMAT(arg_idx)
# define CX_GNUC_NORETURN
# define CX_GNUC_CONST
# define CX_GNUC_UNUSED
#endif
/*
* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with macros.
*/
#if defined (__GNUC__) && (__GNUC__ < 3)
# define CX_GNUC_FUNCTION __FUNCTION__
# define CX_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__
#else /* !__GNUC__ */
# define CX_GNUC_FUNCTION ""
# define CX_GNUC_PRETTY_FUNCTION ""
#endif /* !__GNUC__ */
#define CX_STRINGIFY(macro) CX_STRINGIFY_ARG(macro)
#define CX_STRINGIFY_ARG(contents) #contents
/*
* String identifier for the current code position
*/
#if defined (__GNUC__) && (__GNUC__ < 3)
# define CX_CODE_POS __FILE__ ":" CX_STRINGIFY(__LINE__) ":" __PRETTY_FUNCTION__ "()"
#else
# define CX_CODE_POS __FILE__ ":" CX_STRINGIFY(__LINE__)
#endif
/*
* Current function identifier
*/
#if defined (__GNUC__)
# define CX_FUNC_NAME ((const char*) (__PRETTY_FUNCTION__))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
# define CX_FUNC_NAME ((const char*) (__func__))
#else
# define CX_FUNC_NAME ((const char*) ("???"))
#endif
/*
* C code guard
*/
#undef CX_BEGIN_DECLS
#undef CX_END_DECLS
#ifdef __cplusplus
# define CX_BEGIN_DECLS extern "C" {
# define CX_END_DECLS }
#else
# define CX_BEGIN_DECLS /* empty */
# define CX_END_DECLS /* empty */
#endif
/*
* Some popular macros. If the system provides already a definition for some
* of them this definition is used, assuming the definition is correct.
*/
#ifndef NULL
# ifdef __cplusplus
# define NULL (0L)
# else /* !__cplusplus */
# define NULL ((void *) 0)
# endif /* !__cplusplus */
#endif
#ifndef FALSE
# define FALSE (0)
#endif
#ifndef TRUE
# define TRUE (!FALSE)
#endif
#ifndef CX_MIN
# define CX_MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef CX_MAX
# define CX_MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef CX_ABS
# define CX_ABS(a) ((a) < (0) ? -(a) : (a))
#endif
#ifndef CX_CLAMP
# define CX_CLAMP(a, low, high) (((a) > (high)) ? (high) : (((a) < (low)) ? (low) : (a)))
#endif
/*
* Number of elements in an array
*/
#define CX_N_ELEMENTS(array) (sizeof (array) / sizeof ((array)[0]))
#endif /* CX_MACROS_H */
|