c++-gtk-utils
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
c++-gtk-utils
cgu_config.h
Go to the documentation of this file.
1
/* Copyright (C) 2010 to 2014 Chris Vine
2
3
The library comprised in this file or of which this file is part is
4
distributed by Chris Vine under the GNU Lesser General Public
5
License as follows:
6
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public License
9
as published by the Free Software Foundation; either version 2.1 of
10
the License, or (at your option) any later version.
11
12
This library is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License, version 2.1, for more details.
16
17
You should have received a copy of the GNU Lesser General Public
18
License, version 2.1, along with this library (see the file LGPL.TXT
19
which came with this source code package in the c++-gtk-utils
20
sub-directory); if not, write to the Free Software Foundation, Inc.,
21
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
23
However, it is not intended that the object code of a program whose
24
source code instantiates a template from this file or uses macros or
25
inline functions (of any length) should by reason only of that
26
instantiation or use be subject to the restrictions of use in the GNU
27
Lesser General Public License. With that in mind, the words "and
28
macros, inline functions and instantiations of templates (of any
29
length)" shall be treated as substituted for the words "and small
30
macros and small inline functions (ten lines or less in length)" in
31
the fourth paragraph of section 5 of that licence. This does not
32
affect any other reason why object code may be subject to the
33
restrictions in that licence (nor for the avoidance of doubt does it
34
affect the application of section 2 of that licence to modifications
35
of the source code in this file).
36
37
*/
38
39
#ifndef CGU_CONFIG_H
40
#define CGU_CONFIG_H
41
42
/*
43
* This file is produced from cgu_config.h.in by the ./configure
44
* script.
45
*/
46
47
#undef CGU_USE_GLIB_MEMORY_SLICES_COMPAT
48
#undef CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT
49
50
/*
51
* None of these new operators throw std::bad_alloc as glib terminates
52
* the whole application if it cannot allocate memory.
53
*
54
* These functions are only suitable as class member functions,
55
* because they do not check whether the passed size request value is
56
* 0, and g_slice_alloc() will not allocate any memory if passed a
57
* size of 0. (A class allocator will not be passed a size value less
58
* than 1 as an empty class/struct object has sizeof 1 in C++, so
59
* these will always be safe as member functions.)
60
*
61
* For anyone porting this library to windows, operator new[]() and
62
* operator delete[]() for arrays should not be included, because
63
* Visual Studio does not correctly comply with the C++ standard with
64
* respect to the two argument version of operator delete[]().
65
*/
66
#if defined(CGU_USE_GLIB_MEMORY_SLICES_COMPAT) || defined(CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT)
67
#include <new>
68
#include <cstdlib>
69
#include <glib.h>
70
#define CGU_GLIB_MEMORY_SLICES_FUNCS \
71
static void* operator new(std::size_t s) throw() {return g_slice_alloc(s);} \
72
static void* operator new(std::size_t s, const std::nothrow_t&) throw() {return g_slice_alloc(s);} \
73
static void* operator new(std::size_t s, void* p) throw() {return ::operator new(s, p);} \
74
static void operator delete(void* p, std::size_t s) throw() {if (p) g_slice_free1(s, p);} \
75
static void operator delete(void* p, std::size_t s, const std::nothrow_t&) throw() {if (p) g_slice_free1(s, p);} \
76
static void operator delete(void* p, void* q) throw() {::operator delete(p, q);} \
77
static void* operator new[](std::size_t s) throw() {return g_slice_alloc(s);} \
78
static void* operator new[](std::size_t s, const std::nothrow_t&) throw() {return g_slice_alloc(s);} \
79
static void* operator new[](std::size_t s, void* p) throw() {return ::operator new[](s, p);} \
80
static void operator delete[](void* p, std::size_t s) throw() {if (p) g_slice_free1(s, p);} \
81
static void operator delete[](void* p, std::size_t s, const std::nothrow_t&) throw() {if (p) g_slice_free1(s, p);} \
82
static void operator delete[](void* p, void* q) throw() {return ::operator delete[](p, q);}
83
#else
84
#define CGU_GLIB_MEMORY_SLICES_FUNCS // Using global operator new, new[], delete and delete[]
85
#endif
86
87
/* This determines whether each of the library headers will contain a
88
'using namespace Cgu' directive. It will include such a using
89
directive if configure is passed the --with-cgu-using-directive
90
option. (It can also be edited by hand.)
91
*/
92
namespace
Cgu
{}
93
// do not include using directive
94
95
/* whether the system provides sched_yield */
96
#define CGU_USE_SCHED_YIELD 1
97
98
/* whether the system was found to provide working recursive mutexes
99
when the library was compiled
100
*/
101
#define CGU_HAVE_RECURSIVE_MUTEX 1
102
103
/* whether CallbackArg, FunctorArg and EmitterArg objects may take
104
more than one free argument
105
*/
106
#define CGU_USE_TYPE_TUPLE_ARGS 1
107
108
/* whether ==, != and < operators to be available for smart pointers */
109
#undef CGU_USE_SMART_PTR_COMPARISON
110
111
/* whether the std::queue implementation is standard conforming and
112
inheritable */
113
#define CGU_USE_INHERITABLE_QUEUE 1
114
115
/* whether the library is to be compiled with GTK+ support */
116
#define CGU_USE_GTK 1
117
118
/* whether the library is to be compiled with support for guile
119
extensions */
120
#define CGU_USE_GUILE 1
121
122
/* whether guile correctly links scm_dynwind_block_asyncs() */
123
#undef CGU_GUILE_HAS_BROKEN_LINKING
124
125
/* whether gcc diagnostic pragmas are available */
126
#define CGU_USE_DIAGNOSTIC_PRAGMAS 1
127
128
#endif // CGU_CONFIG_H
Cgu
Definition:
application.h:45
Generated on Mon Jan 27 2020 10:40:51 for c++-gtk-utils by
1.8.17