Ginga
0.13.6.1771-df200
The iTV middleware.
Main Page
Classes
Files
File List
File Members
aux-glib.h
Go to the documentation of this file.
1
/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
2
3
This program is free software: you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation, either version 2 of the License, or
6
(at your option) any later version.
7
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License
14
along with this program. If not, see <http://www.gnu.org/licenses/>. */
15
16
#ifndef AUX_GLIB_H
17
#define AUX_GLIB_H
18
19
#include <glib.h>
20
#include <glib/gstdio.h>
21
22
#define cast(t, x) ((t)(x))
23
#define deconst(t, x) ((t)(ptrdiff_t)(const void *)(x))
24
#define devolatile(t, x) ((t)(ptrdiff_t)(volatile void *)(x))
25
#define integralof(x) (((char *)(x)) - ((char *) 0))
26
#define likely G_LIKELY
27
#define nelementsof(x) G_N_ELEMENTS ((x))
28
#define pointerof(x) ((void *)((char *) 0 + ((size_t)(x))))
29
#define strbool(x) ((x) ? "true" : "false")
30
#define tryset(p, x) ((p) ? *(p) = (x) : (x))
31
#define unlikely G_UNLIKELY
32
#define unused(arg) arg G_GNUC_UNUSED
33
34
#ifndef GNUC_PREREQ
35
# if defined __GNUC__ && defined __GNUC_MINOR__
36
# define GNUC_PREREQ(major, minor)\
37
((__GNUC__ > (major)) || ((__GNUC__ == (major)) &&\
38
(__GNUC_MINOR__ >= (minor))))
39
# else
40
# define GNUC_PREREQ(major, minor) 0
41
# endif
42
#endif
43
44
#if GNUC_PREREQ (4,2)
45
# define _GCC_PRAGMA(x) _Pragma (G_STRINGIFY (x))
46
# define PRAGMA_DIAG(x) _GCC_PRAGMA (GCC diagnostic x)
47
#elif defined (__clang__)
48
# define _CLANG_PRAGMA(x) _Pragma (G_STRINGIFY (x))
49
# define PRAGMA_DIAG(x) _CLANG_PRAGMA (clang diagnostic x)
50
#else
51
# define PRAGMA_DIAG(x)
52
#endif
53
54
#if GNUC_PREREQ (4,6) || defined (__clang__)
55
# define PRAGMA_DIAG_PUSH() PRAGMA_DIAG (push)
56
# define PRAGMA_DIAG_POP() PRAGMA_DIAG (pop)
57
#else
58
# define PRAGMA_DIAG_PUSH()
59
# define PRAGMA_DIAG_POP()
60
#endif
61
62
#define PRAGMA_DIAG_IGNORE(x) PRAGMA_DIAG (ignored G_STRINGIFY (x))
63
#define PRAGMA_DIAG_WARNING(x) PRAGMA_DIAG (warning G_STRINGIFY (x))
64
65
#endif
/* AUX_GLIB_H */
lib
aux-glib.h
Generated on Thu Nov 30 2017 09:59:17 for Ginga by
1.8.11