cleanup: protected -> hidden: cleanup symbol table
[babeltrace.git] / include / babeltrace / compiler.h
CommitLineData
d79865b9
MD
1#ifndef _BABELTRACE_COMPILER_H
2#define _BABELTRACE_COMPILER_H
3
ccd7e1c8
MD
4/*
5 * compiler.h
6 *
7 * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 */
19
334c0a83
MD
20#include <stddef.h> /* for offsetof */
21
d79865b9
MD
22#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
23
fc93b2bd
MD
24#ifndef container_of
25#define container_of(ptr, type, member) \
26 ({ \
27 const typeof(((type *)NULL)->member) * __ptr = (ptr); \
28 (type *)((char *)__ptr - offsetof(type, member)); \
29 })
30#endif
31
d79865b9 32#endif /* _BABELTRACE_COMPILER_H */
This page took 0.027415 seconds and 4 git commands to generate.