macro.h revision e99e38bbdcca3fe5956823bdb3d38544ccf93221
/*-*- Mode: C; c-basic-offset: 8 -*-*/
#ifndef foomacrohfoo
#define foomacrohfoo
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
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.
systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#define _const __attribute__ ((const))
#define _unlikely(x) (__builtin_expect(!!(x),0))
/* Rounds up */
return ((l + sizeof(void*) - 1) & ~(sizeof(void*) - 1));
}
#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
#define MAX(a,b) \
__extension__ ({ \
})
#define MIN(a,b) \
__extension__ ({ \
})
__extension__ ({ \
})
do { \
"Assertion '%s' failed at %s:%u, function %s(). Aborting.", \
} while (false) \
/* We override the glibc assert() here. */
#ifdef NDEBUG
#else
#endif
#define assert_not_reached(t) \
do { \
"Code should not be reached '%s' at %s:%u, function %s(). Aborting.", \
} while (false)
do { \
switch (0) { \
case 0: \
case !!(expr): \
; \
} \
} while (false)
#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
#define UINT_TO_PTR(u) ((void*) ((uintptr_t) (u)))
#define UINT32_TO_PTR(u) ((void*) ((uintptr_t) (u)))
#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
#define INT_TO_PTR(u) ((void*) ((intptr_t) (u)))
#define INT32_TO_PTR(u) ((void*) ((intptr_t) (u)))
#define char_array_0(x) x[sizeof(x)-1] = 0;
#define IOVEC_SET_STRING(i, s) \
do { \
char *_s = (char *)(s); \
} while(false);
#include "log.h"
#endif