Move to kernel style SPDX license identifiers
[lttng-ust.git] / include / lttng / ust-tracer.h
... / ...
CommitLineData
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * This contains the core definitions for the Linux Trace Toolkit.
7 */
8
9#ifndef _LTTNG_UST_TRACER_H
10#define _LTTNG_UST_TRACER_H
11
12#include <limits.h>
13
14#if defined (__cplusplus)
15#include <type_traits>
16#endif
17
18#include <lttng/ust-compiler.h>
19#include <lttng/ust-config.h>
20#include <lttng/ust-version.h>
21
22#ifndef LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS
23/* Align data on its natural alignment */
24#define RING_BUFFER_ALIGN
25#endif
26
27#ifndef CHAR_BIT
28#define CHAR_BIT 8
29#endif
30
31#ifdef RING_BUFFER_ALIGN
32#define lttng_alignof(type) __alignof__(type)
33#else
34#define lttng_alignof(type) 1
35#endif
36
37#define lttng_is_signed_type(type) ((type) -1 < (type) 0)
38
39/*
40 * This macro adds a compilation assertion that CTF arrays and sequences
41 * declared by the users are of an integral type.
42 */
43
44#if defined(__cplusplus)
45#define _lttng_is_integer(type) (std::is_integral<type>::value)
46#else
47#define _lttng_is_integer(type) (__builtin_types_compatible_p(type, _Bool) || \
48 __builtin_types_compatible_p(type, char) || \
49 __builtin_types_compatible_p(type, unsigned char) || \
50 __builtin_types_compatible_p(type, short) || \
51 __builtin_types_compatible_p(type, unsigned short) || \
52 __builtin_types_compatible_p(type, int) || \
53 __builtin_types_compatible_p(type, unsigned int) || \
54 __builtin_types_compatible_p(type, long) || \
55 __builtin_types_compatible_p(type, unsigned long) || \
56 __builtin_types_compatible_p(type, long long) || \
57 __builtin_types_compatible_p(type, unsigned long long))
58#endif
59
60#define _lttng_array_element_type_is_supported(_type, _item) \
61 lttng_static_assert(_lttng_is_integer(_type), \
62 "Non-integer type `" #_item "` not supported as element of CTF_ARRAY or CTF_SEQUENCE", \
63 Non_integer_type__##_item##__not_supported_as_element_of_CTF_ARRAY_or_CTF_SEQUENCE);
64
65#endif /* _LTTNG_UST_TRACER_H */
This page took 0.022761 seconds and 4 git commands to generate.