gen.py: add _CCodeGenerator._create_{file_}template() methods
[deliverable/barectf.git] / extra / barectf-tracepoint.h
1 #ifndef _BARECTF_TRACEPOINT_H
2 #define _BARECTF_TRACEPOINT_H
3
4 /*
5 * The MIT License (MIT)
6 *
7 * Copyright (c) 2016 Philippe Proulx <pproulx@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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
26 */
27
28 /* get prefix */
29 #ifdef BARECTF_TRACEPOINT_PREFIX
30 # define _BARECTF_TRACEPOINT_PREFIX BARECTF_TRACEPOINT_PREFIX
31 #else
32 # ifdef _BARECTF_PREFIX
33 # define _BARECTF_TRACEPOINT_PREFIX _BARECTF_PREFIX
34 # else
35 # error You need to define BARECTF_TRACEPOINT_PREFIX in order to use this header.
36 # endif
37 #endif
38
39 /* get stream name to use */
40 #ifdef BARECTF_TRACEPOINT_STREAM
41 # define _BARECTF_TRACEPOINT_STREAM BARECTF_TRACEPOINT_STREAM
42 #else
43 # ifdef _BARECTF_DEFAULT_STREAM
44 # define _BARECTF_TRACEPOINT_STREAM _BARECTF_DEFAULT_STREAM
45 # else
46 # error You need to define BARECTF_TRACEPOINT_STREAM in order to use this header.
47 # endif
48 #endif
49
50 /* get context to use */
51 #ifndef BARECTF_TRACEPOINT_CTX
52 # error You need to define BARECTF_TRACEPOINT_CTX in order to use this header.
53 #endif
54
55 /*
56 * Combines 6 token. Inspired by __TP_COMBINE_TOKENS4() in
57 * <lttng/tracepoint.h>. See sections 6.10.3 and 6.10.3.1 of
58 * ISO/IEC 9899:1999.
59 */
60 #define __COMBINE_TOKENS6(_a, _b, _c, _d, _e, _f) \
61 _a ## _b ## _c ## _d ## _e ## _f
62 #define _COMBINE_TOKENS6(_a, _b, _c, _d, _e, _f) \
63 __COMBINE_TOKENS6(_a, _b, _c, _d, _e, _f)
64
65 /* tracepoint() used by the user */
66 #undef tracepoint
67 #define tracepoint(_prov_name, _tp_name, ...) \
68 _COMBINE_TOKENS6(_BARECTF_TRACEPOINT_PREFIX, _BARECTF_TRACEPOINT_STREAM, _trace_, _prov_name, _, _tp_name)(BARECTF_TRACEPOINT_CTX, ##__VA_ARGS__)
69
70 #endif /* _BARECTF_TRACEPOINT_H */
This page took 0.049973 seconds and 4 git commands to generate.